Create user by api?

lopezgioc
Community Novice

Good day to everyone. I have the question of whether you can create a canvas account and then be assigned to a course. Validating the API: Users API The api requests what is /api/v1/accounts/:account_id/users , where I can not find my account_id (my account is a canvas.instructure account). What I want is to be able to send them an email so people can register and assign them to the course. thanks for your help

$rute = "canvas.instructure.com/api/v1/accounts/:account_id/users";
$prtts = array('pseudonym[unique_id]' => 'myemail@gmail.com');

$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $rute);
curl_setopt($cURL, CURLOPT_HEADER, true);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_POST, true);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $prtts);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer MyToken' //here goes my token
));

$res = curl_exec($cURL);

var_dump($res);

curl_close($cURL); ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I understand that when sending my parameter, which is myemail@gmail.com, should I get an email to register?

0 Likes