AnsweredAssumed Answered

PHP / GuzzleHttp Post - new user creation

Question asked by Jeremiah Ellington on Jun 14, 2018
Latest reply on Jun 15, 2018 by Jeremiah Ellington



I'm new to Canvas and attempting to create a new user through the Canvas API. I'm using PHP & GuzzleHttp to form the requests and getting the following error:


Client error: `POST` resulted in a `400 Bad Request` response: {"errors":{"user":{"pseudonyms":[{"attribute":"pseudonyms","type":"invalid","message":"invalid"}]},"pseudonym":{"unique_ (truncated...)


I'm setting the URL:

$url = "$access_token";


I'm setting the Content-Type in the header of the Request:

headers = [
                'Content-Type' => 'application/json; charset=utf-8',
                'Accept' => 'application/json',


I'm using the below data in the body of the Post Request:

{"user":{"name":"Mary Alvarez Nutting","sortable_name":"Alvarez Nutting Mary"},"pseudonym":{"unique_id":"Mary_AlvarezNutting","sis_user_id":"1033587"}



and finally here is the Guzzle command i'm using:

$response = $client->post($url, $headers, $parm)->send();


Any help at all would be greatly appreciated!!


If any does look at this, Please let me know if I can provide anymore information that would help you help me!!!


Thank you,