To Our Amazing Educators Everywhere,
Happy Teacher Appreciation Week!
Found this content helpful? Log in or sign up to leave a like!
Hi developers
At the school I work for, we're currently transitioning from using student e-mail addresses as their unique identifying parameter to using SIS IDs instead. It's no issue adding new students by SIS import, but the existing students have a SIS ID in our SIS that needs to be assigned to their (already existing) Canvas accounts. I've read through a lot of documentation but I can't seem to find a way of doing this - it's as if the API is simply not designed to be able to assign SIS IDs after the creation of an account.
Still, it's doable by manually editing each student's account and inserting the SIS ID in their log-in information. This appears to set the SIS ID for the account as well as the log-in which appear to be two different data parameters. But this is not really a solution as it would take way too long.
What I'm essentially looking for is a way to do it, using the API, for just one student. I can program the rest from there. Does anyone know of a way? Or if not, maybe someone could confirm that it's impossible?
Thanks in advance. 🙂
Solved! Go to Solution.
Hi @michael5,
That's definitely strange. The only time I've experienced something like that is when info in the CSV file doesn't match what's in Canvas (or is excluded form the CSV). For example, if your current logins are tied to a specific authentication provider and you don't have the provider id in the CSV file, a new user will be created because there isn't an exact match to existing info Canvas can find.
I suppose in this case it may be easier to go the Logins API route than try to figure ths CSV thing out, unless there's an incredibly obvious difference you can notice with the CSVs. I often run an sis_export report from our root account when working on stuff like this so I know I have the exact data Canvas has, then modify from there and re-upload.
-Chris
So I think what you're wanting to do is assign a SIS IDs to a set of users who don't currently have one? A SIS ID on a user is associated with their login and a user can have multiple logins associated to their account, this is why you can't directly edit the SIS ID on a user through the users API. Instead you need to use the logins API.
If you have the Canvas ID for a user (the incrementing number), then first you need to list the logins for that user with:
https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.index
Then once you have the ID of the login you want to update you can use the edit login endpoint to add the SIS ID and make sure you pass the login[sis_user_id] parameter.
https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.update
I hope that makes sense.
Matthew
@matthew_buckett wrote:
So I think what you're wanting to do is assign a SIS IDs to a set of users who don't currently have one?
Precisely!
@matthew_buckett wrote:
A SIS ID on a user is associated with their login and a user can have multiple logins associated to their account, this is why you can't directly edit the SIS ID on a user through the users API. Instead you need to use the logins API.
If you have the Canvas ID for a user (the incrementing number), then first you need to list the logins for that user with:
https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.index
Then once you have the ID of the login you want to update you can use the edit login endpoint to add the SIS ID and make sure you pass the login[sis_user_id] parameter.
https://canvas.instructure.com/doc/api/logins.html#method.pseudonyms.update
I hope that makes sense.
Matthew
Ah!! This explains so much that I was confused about - SIS ID on account level vs SIS ID on log-in level and why it can't just be assigned like any other user information using the API). I'll give it a spin and mark this correct if it works. Thank you so much.
Michael
Hi @michael5,
You shouldn't even need to use the API for this anymore actually. If you take a look at the SIS Import documentation, you'll see you can create a "change_sis_id.csv" file to accomplish this pretty easily.
You'll basically need a csv file with a header line of "old_id,new_id,type" and then for each student you'll have a data line with their old sis_id, the new sis_id, and "user" as the type.
If, for whatever reason, you still want to attempt to do this via the API, it would be the logins method you'd work with. You'd need to list the logins per user to find the login_id with the sis_id you're looking to update, then edit that login to make the change. I had to do this in the past before the CSV method above was introduced, and while it did work out, the CSV method is infinitely simpler.
Hope this helps!
-Chris
As @chriscas mentioned the CSV file is much easier, but this only works if your user accounts already have a SIS ID to change, if you didn't set the email address as the SIS ID (or something else) then you'll need to use the API.
Good call, @matthew_buckett, I keyed in on the statement "transitioning from using student e-mail addresses as their unique identifying parameter to using SIS IDs instead," and somewhat assumed there was some kind of existing sis_id being used in Canvas already.
If there is no sis_id at all for the users, you could usually just do a regular users.CSV file, and Canvas will add the sis_id field to users based on the login_id. I guess one thing we should also clarify in this conversation is whether you mean you're updating the sis+id field in Canvas with the sis_id from your SIS, or if you're perhaps actually wanting to update the login_id in Canvas or some other parameter. The terminology is definitely easy to mix up between different systems.
-Chris
I was hoping the SIS users.csv import would work like that ie. by adding the SIS ID and determining which student to add it to using login_id parameter, but instead it creates a new user.
I tested it with a dummy e-mail account and it just created a new user with the given SIS ID instead of adding the SIS ID to the existing user with the exact same login_id.
They have the same log-in information, only difference is one has a SIS ID attached and one doesn't. Not sure what happens if I actually sign in to either account. 🙂
Hi @michael5,
That's definitely strange. The only time I've experienced something like that is when info in the CSV file doesn't match what's in Canvas (or is excluded form the CSV). For example, if your current logins are tied to a specific authentication provider and you don't have the provider id in the CSV file, a new user will be created because there isn't an exact match to existing info Canvas can find.
I suppose in this case it may be easier to go the Logins API route than try to figure ths CSV thing out, unless there's an incredibly obvious difference you can notice with the CSVs. I often run an sis_export report from our root account when working on stuff like this so I know I have the exact data Canvas has, then modify from there and re-upload.
-Chris
It may actually be related to the login_provider parameter now that you mention it. I specifically put "Canvas" when I was testing this solution but maybe it should just be nothing? I'm not sure what this defaults to when users are added to the system outside of SIS imports but I assumed it was "Canvas". We don't have any external authentication providers. I'll definitely try again without Canvas as login_provider or figure out exactly what it is, using the SIS exports.
Thanks!
Michael
Hi again Chris
It worked! I checked the exports was unable to find students who were not added by SIS import or who had a manually assigned SIS ID. So I took a guess and left it blank and that did the trick, it found the already existing student by login_id and updated the SIS ID.
So in effect, students without an "authentication_provider_id" do not default to "Canvas" or anything else but make up their own, null-value/empty string category.
Thanks @chriscas and @matthew_buckett for the help. I'd mark both as correct but this turned out to be the easiest in our specific environment. 🙂
Michael
Hi Chris,
Thanks, I actually saw this but the existing students were not assigned a SIS ID upon creation so they don't have an "old_sis_id". 😞
Michael
To participate in the Instructure Community, you need to sign up or log in:
Sign In