Update user email address via API

nschutz
Community Contributor

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"
      ),
    ));

 

Labels (3)
0 Likes