cancel
Showing results for 
Search instead for 
Did you mean: 
kfavara
Community Participant

Using enable_sis_reactivation in Courses/Sections via API

Jump to solution

I am trying to use the enable_sis_reactivation option for courses and sections, using the API. I have not previously marked the enable_sis_reactivation in courses or sections previous to using the API. I can use the GET to determine if a course/section is active. If it is not active, how do I find a deleted course/section using the API to know whether to update it or create it. I did not see the enable_sis_reactivation as a parameter in the API for update, but I can test that. But first, I need to determine whether it is deleted to know to PUT an update or PUSH to create. 

Any help from someone who has worked through this would be appreciated. I haven't gotten to users yet, but I will have the same questions there. 

Labels (1)
1 Solution

Accepted Solutions
James
Community Champion

 @kfavara ,

Two things jump out at me.

The documentation for enable_sis_reactivation says

When true, will first try to re-activate a deleted section with matching sis_section_id if possible.

Notice the non-committal language there? "try" and "if possible". Maybe it isn't possible to reactivate the section you're trying to re-activate.

The second is what you're trying to send. I didn't test what you said you're sending, so I can't say for sure that it won't work.  However, I tested what the documentation says to send and it worked for me and what you're sending doesn't match the documentation I'm looking at so maybe we're looking in two places.

The URL you're using matches the Create course section endpoint of the Sections API. It's the same URL for Listing the sections, with a GET, but Create with a POST. You definitely need to be doing a POST.

I created a course by POSTing the following JSON to /api/v1/courses/2151246/sections

{
  "course_section":{
    "name":"test section",
    "sis_section_id":"m113beta-test01"
  },
}

It returned this object

240366_pastedImage_5.png

I then deleted it by sending a DELETE to /api/v1/sections/2416439

The section was deleted form my course.

Now I try to create the section again by doing a POST to /api/v1/courses/2151246/sections

This time the payload is

{
  "course_section":{
    "sis_section_id":"m113beta-test01"
  },
  "enable_sis_reactivation":true
}

And my section is back with the same Canvas section ID (2416439) that it had to start with.

View solution in original post

3 Replies
pklove
Community Champion

If its is deleted you do not have to worry about this.

Just do a create (POST) with enable_sis_reactivation as true.

If the course does not exist it will be created, if its deleted it will be re-activated, if possible.

kfavara
Community Participant

This is not working for me. Instead of reactivating the old one, it keeps creating a new section. When I run it in Postman, I get a 200 status. Which I guess is true, since it successfully creates a new section. But, it will not reactivate the old. When I run a report that shows the deleted sections, the applicable section is in the deleted list.

I am sending to the following:

https://site.instructure.com/api/v1/courses/sis_course_id:001-17-0105-09/sections

I am sending:

{"section":{"sis_course_id":"001-17-0105-09","sis_section_id":"1-17-0105-09-502","name":"01-YORK","enable_sis_reactivation":"true"}}

Please let me know if you see what I'm doing wrong.

James
Community Champion

 @kfavara ,

Two things jump out at me.

The documentation for enable_sis_reactivation says

When true, will first try to re-activate a deleted section with matching sis_section_id if possible.

Notice the non-committal language there? "try" and "if possible". Maybe it isn't possible to reactivate the section you're trying to re-activate.

The second is what you're trying to send. I didn't test what you said you're sending, so I can't say for sure that it won't work.  However, I tested what the documentation says to send and it worked for me and what you're sending doesn't match the documentation I'm looking at so maybe we're looking in two places.

The URL you're using matches the Create course section endpoint of the Sections API. It's the same URL for Listing the sections, with a GET, but Create with a POST. You definitely need to be doing a POST.

I created a course by POSTing the following JSON to /api/v1/courses/2151246/sections

{
  "course_section":{
    "name":"test section",
    "sis_section_id":"m113beta-test01"
  },
}

It returned this object

240366_pastedImage_5.png

I then deleted it by sending a DELETE to /api/v1/sections/2416439

The section was deleted form my course.

Now I try to create the section again by doing a POST to /api/v1/courses/2151246/sections

This time the payload is

{
  "course_section":{
    "sis_section_id":"m113beta-test01"
  },
  "enable_sis_reactivation":true
}

And my section is back with the same Canvas section ID (2416439) that it had to start with.

View solution in original post