Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
Found this content helpful? Log in or sign up to leave a like!
According the update user API , we should be able to update a user's default email address. the same PUT request below works in Postman, but not in PHP/cURL. Very strange. I tried both checking the box in the root account setting Users can delete their institution-assigned email address and not checking the box. Any insight appreciated!
$updateEmailURL = "https://" . $domain . "/api/v1/users/". $uid . "?user[email]=" . urlencode($userEmail);
curl_setopt_array($curl, array(
CURLOPT_URL => $updateEmailURL,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => array(
$header,
"cache-control: no-cache"
),
));
Hi @nschutz ,
What's the error that you're getting when you try to run the PHP code? If the request works in Postman (presumably with the same token), then the settings/permissions on the Canvas side seem fine and there's likely a problem with the PHP code.
--Colin
Hi @ColinMurtaugh ,
Yes, same token. No error, RC is 200. The only difference I can tell between PHP and Postman is that I have to encode email address in PHP.
I looked into the response object, it does say "invalid url". So I assume the urlencode function is not the solution? I also tried curl_escape and didn't work either. The problem is there is an @ symbol in the url which causes the error.
Unfortunately I don't have much experience with PHP -- hopefully some other more knowledgeable person can help! 🙂
--Colin
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign InTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign In