Any hints how to get a term_id based on the sis_term_id? I need to place a course in a specific term, but I need the term id and I only have the sis_term_id. FYI, adding course through COURSE API.
Thanks
You actually can use the sis_term_id in your API calls. The details about that can be found here: Object IDs, SIS IDs, and special IDs - Canvas LMS REST API Documentation
Basically instead of putting the term ID in the API call you just add "sis_term_id:" in front of the SIS term ID in the API call.
Hi Matt,
Yes, I already tried that, but I dont get any results:
http://mydomain/api/v1/accounts/1/terms/sis_term_id:1234
I am trying to create a course using
http://mydomain/api/v1/accounts/1/courses/
together with the post parameters, one of them being term_id, not sis_term_id.
I don't think there is a GET call for a specific term, but you can get all the terms and show the term ID that you need for creating the course by using the https://mydomain/api/v1/accounts/1/terms/ call.
I know, then loop till I find a match for the sis_term_id. Wish there could be a direct call.
Thanks
If you really did need to get the id, rather than using sis_term_id:termid in its place, a workaround instead of getting all terms is to do an update (PUT) using sis_term_id:termid and the term name. The update returns a term object which has the id in it.
Eg:
curl $server/api/v1/accounts/1/terms/sis_term_id:NK1 \
-X PUT \
-F "enrollment_term[name]=NK One" \
-H "Authorization: Bearer $token"
will return
{"id":35,"name":"NK One", ....
One more thing, when I create courses using the API, I always send it as a JSON object. Here is an example of the JSON object to send if I want to use the sis_term_id:
{
"course":
{
"name": "Multicultural Literature",
"course_code": "23.X670",
"sis_course_id": "23.X670T16-17",
"term_id": "sis_term_id:FY-16-17"
}
}ββββββββββ
ok ok, that's different, didn't know about that trick. I will give it a try.
ok, just confirming key:value value for key term_id works.