Register for InstructureCon25 • Passes include access to all sessions, the expo hall, entertainment and networking events, meals, and extraterrestrial encounters.
I would like to edit the user through API C#. Can I have a sample Json for both?
I'm referring to this link for edit a user.
Solved! Go to Solution.
In many cases, you can use both, but the SIS IDs always need prefaced. See SIS IDs in the documentation.
If a person had a SIS User ID of 12345, then you would need to use: { "id" : "sis_user_id:12345" }
There are a few places where SIS IDs are not supported, although it's not always clear where that is. Normally if it says :user_id or :course_id and there is a corresponding sis_id counterpart, then you can use it. If it just says :id then you may have to double check. I keep a copy of the the Canvas IDs for courses, sections, users in a local database after creation so I can refer to them in my API calls and almost never use the SIS IDs directly. I think that was because not as much had a SIS alternative when I started using Canvas.
The JSON works the same was as other snippets we've recently supplied you. Once you understand the process, you won't need to keep asking for snippets.
For editing a user, everything needs wrapped inside a user property.
The query parameter form
user[name]=John%20Smith&user[short_name]=Johnny
would be encoded as
{ "user" : { "name" : "John Smith", "short_name" : "Johnny" } }
For deleting a user, there is no JSON needed.
Thanks for the reply. I already tried the below way and having an error -> The remote server returned an error: (422) Unprocessable Entity.
For Editing
My sample Endpoint is : https://xxxx/api/v1/users?123456
Sample Json: "{\"student\":{\"name\":\"yyyyy\",\"short_name\":\"xxx\",\"time_zone\":\"singapore\",\"email\":\"alice.adeney.26@nexus.edu.sg\"}}". i tried both "student" & User
Many Thanks.
Dear Navigator,
Please ignore my previous messages. Actually, I was using SIS ID as an id (used as a parameter) but when I use Id from API response, it's working.
for example :
[{"id":162,"name":"Rania Adel"
What I assumed is, API use "sis_user_id" as an ID field
If possible, please clarify for me which one is right to use as an ID field (for API point of view).
Many thanks.
In many cases, you can use both, but the SIS IDs always need prefaced. See SIS IDs in the documentation.
If a person had a SIS User ID of 12345, then you would need to use: { "id" : "sis_user_id:12345" }
There are a few places where SIS IDs are not supported, although it's not always clear where that is. Normally if it says :user_id or :course_id and there is a corresponding sis_id counterpart, then you can use it. If it just says :id then you may have to double check. I keep a copy of the the Canvas IDs for courses, sections, users in a local database after creation so I can refer to them in my API calls and almost never use the SIS IDs directly. I think that was because not as much had a SIS alternative when I started using Canvas.
To interact with Panda Bot in the Instructure Community, you need to sign up or log in:
Sign In
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.