After an outage on September 1, the Instructure Community is now fully available, including guides, release notes, forums, and groups. If some styling still looks unusual, clear your cache and cookies.
Found this content helpful? Log in or sign up to leave a like!
From looking at the communication channel api docs, we can get a list of existing email addresses, and create/delete them. But there's no way to set one as primary. Am I just missing something obvious?
I believe the primary email is set in the Users API.
https://<domain>.instructure.com/api/v1/users/<user ID>?user[email]=<email address>
That's not one of the fields that the docs show as being valid:
Canvas LMS REST API Documentation
I tried it anyway, though, and the most promising response I got was this, which I got when I tried to PUT that url, but with "user[email]=<my email address>" passed as a form field. Got the same response for "user[primary_email]=<my email>".
{
"errors": [
{
"message": "user not authorized to perform that action"
}
],
"status": "unauthorized"
}
You might not have the privileges necessary to do this. I'm the account admin for our District and my credentials allow this. I've tested it using the Live API and using a Chrome Extension called "PostMan".
I was trying it with my own account, though...I'd imagine a user should always be able to update their own preferred email address. Anyway, thanks!
I wonder if this is only enabled on hosted Canvas. I just built a new version of this dockerized Canvas, verified that the default user is a site admin, added a new email address to that account, and tried to switch it to primary via:
http -v -f put http://$(docker-machine ip dev):8003/api/v1/users/1 Authorization:"Bearer canvas-docker" "user[email]"=canvas@example.org
I'm still getting the same result:
$ http -v -f put http://$(docker-machine ip dev):8003/api/v1/users/1 Authorization:"Bearer canvas-docker" "user[email]"=canvas@example.org
PUT /api/v1/users/1 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Bearer canvas-docker
Connection: keep-alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: 192.168.99.100:8003
User-Agent: HTTPie/0.9.2
user%5Bemail%5D=canvas%40example.org
HTTP/1.1 401 Unauthorized
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Connection: close
Content-Type: application/json; charset=utf-8
Date: Fri, 28 Aug 2015 20:14:10 GMT
Pragma: no-cache
Server: thin
Set-Cookie: _csrf_token=deC9jjiRf40Q%2Bi7tAm3iP4ORK%2B82bYXHkjjTWWxHlVUEtNHgWuU%2BxSWcbLdKX45ayKRygHsut6b8butyGRSiBQ%3D%3D; path=/
Set-Cookie: _normandy_session=_6HxPDl9THUG7iS2p_78iQ.qMHzy3MxRPTYeqeUTnl5y3lAwMTfeojnzgMfGXIn1jUHUP8xXLFA1ij0_PhRz9m32VmX5bAtQri76dfOTXSYzpvpp7L_hsl3bVm94Yy1tvVE-yJUTh7YjIDVmJyHmEBW.XZyxdNfeOGpYdcHnyusBw8FAuRs.VeDBEg; path=/; HttpOnly
X-Canvas-Meta: at=10000000000001;dk=10000000000001;o=users;n=update;b=617484;m=617484;u=0.04;y=0.00;d=0.00;
X-Canvas-User-Id: 10000000000001
X-Frame-Options: SAMEORIGIN
X-Rack-Cache: invalidate, pass
X-Rate-Limit-Remaining: 600
X-Request-Context-Id: 435bf0a3-729b-441b-8dca-9ff38a3440ee
X-Request-Cost: 0.043873478999999146
X-Runtime: 0.039573
X-Session-Id: f91271ff11fbd36b1510e1cd6ef31445
X-UA-Compatible: IE=Edge
{
"errors": [
{
"message": "user not authorized to perform that action"
}
],
"status": "unauthorized"
}
30719670, I have spent more time than I would care poking at this problem, and was unable to find an endpoint that allowed me to change the primary email. The user profile docs looked promising, but there is only a GET endpoint for that data. I tried PUTing to both the user endpoint and the profile endpoint without success.
Hi 30719670,
I am going through having a look at some of the early days in the Canvas Developers group, and checking in to see if older enquiries have been answered. I also noticed there hasn’t been any discussion on this question in quite some time.
I am wondering, were you ever able to resolve this? I am hoping I can assume that it is well and truly resolved by now, but if not, please let us know and we can certainly have another look. Alternatively, if have some insights you may be able to share for others that would be awesome too!
I will mark this as assumed answered for the time being, however, by all means please let us know if you still have an outstanding question and we will take a peek!
Cheers,
Stuart
I am having the same issue with changing the value of SIS ID via API using Postman. However, when using the exact identical Postman configuration, I can change (edit) any other fields such as email, name, etc. I am an account ADMIN. Can you tell me what I am doing wrong?
Below is my Postman Configuration:
URL: PUT https://OurServer.com/api/v1/users/48984
Headers:
Accept: application/json+canvas-string-ids
Content-Type: application/json
Authorization: Bearer 13468~4k5f646xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxh9N2rfYHgEID1c
Body:
{"user" : { "id" : "sis_user_id:f34be" } }
Or
{"user" : {"sis_user_id": " f34be" } }
*** Either REQUEST Body's work.
Response:
{
"status": "unauthorized",
"errors": [
{
"message": "user not authorized to perform that action"
}
]
}
SIS user IDs are tied to a login. Have you tried the Edit a user login endpoint ?
PUT /api/v1/accounts/self/logins/48984
{ "login" : { "sis_user_id" : "f34be" } }
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