[ARCHIVED] Bad request when posting user against rest api

Jump to solution
StefanNorinder
Community Explorer

Dear Community, 

I'm trying to create a user with Canvas rest api. Here's the json I'm posting: 

{
   "user":{
      "Name":"Foo bar"
   },
   "pseudonym":{
      "Unique_id":"foobar@mailinator.com"
      
   }
}

And here's the response from Canvas: 

{
    "errors": {
        "user": {
            "pseudonyms": [
                {
                    "attribute""pseudonyms",
                    "type""invalid",
                    "message""invalid"
                }
            ]
        },
        "pseudonym": {
            "unique_id": [
                {
                    "attribute""unique_id",
                    "type""invalid",
                    "message""invalid"
                },
                {
                    "attribute""unique_id",
                    "type""too_short",
                    "message""too_short"
                }
            ]
        },
        "observee": {},
        "pairing_code": {},
        "recaptcha"null
    }
}
 
I've tried a lot of different syntaxes but with the same result. Please help. 
Labels (2)
0 Likes
1 Solution
StefanNorinder
Community Explorer
Author

Thanks @dtod for your reply! 

I managed to figure out what was wrong. `Unique_id` needs to be in lowercase. Since I pass `Unique_Id` I guess Canvas gott `null` and went "well, this ID is way to short!" 

So all is well, for now. 

View solution in original post

0 Likes