cancel
Showing results for 
Search instead for 
Did you mean: 
wjlane
Surveyor

Using the API to save integration_data for an assignment group

Jump to solution

Thanks to a previous question I was able to update an assignments integration_data using :

assignment[integration_data]={"id":1XXXX,"heading":"My Heading"}

Now I need to do the same for an assignment group but none of the following variations have worked :

assignment_group[integration_data]={"id":1XXXX,"heading":"My Heading"}
assignment_groups[integration_data]={"id":1XXXX,"heading":"My Heading"}
integration_data={"id":1XXXX,"heading":"My Heading"}

I'm hoping someone here can point me in the right direction.

Labels (1)
1 Solution

Accepted Solutions

If its as parameters, break the data bit out into the parameters.

This worked for me:

  curl -k $server/api/v1/courses/$course_id/assignment_groups/$assgrp_id \
   -X PUT \
   -F "integration_data[id]=123" \
   -F "integration_data[heading]=Some Heading" \
   -H "Authorization: Bearer $token"

View solution in original post

7 Replies
pklove
Learner II

According to the docs (Assignment Groups - Canvas LMS REST API Documentation) the last one your have is correct.  That is, just integration_data=...

What endpoint are you POSTing to and what do you get back?  Do you get an error, or no error but the data aren't updated?

Hi Peter,

thanks for the reply.

I'm PUTing to the edit Assignment Group Endpoint and the url looks like this :

https://ours.instructure.com/api/v1/courses/7638/assignment_groups/7635?access_token=OurAccessToken&...

I'm getting back "Invalid integration data" in Postman.

Using position works fine and returns the expected AssignmentGroup object :

https://ours.instructure.com/api/v1/courses/7638/assignment_groups/7635?access_token=OurAccessToken&...

Using any of the other options I have above also returns the expected AssignmentGroup object but with no change to the integration_data component.

Ah, sorry about the POST, was looking at a creation.

Just tried an update using curl and sending json and it worked fine.  It looked like:

  json='{ "integration_data": {"id":"1XXXX","heading":"My Heading"} }'

  curl -k $server/api/v1/courses/$course_id/assignment_groups/$assgrp_id \
   -X PUT \
   -H "Authorization: Bearer $token" \
   -H "Content-Type: application/json" \
   --data "$json"

If its objecting to the integration data, looking at the above, have you tried quotes around your "1XXXX"?

Ah, if your 1XXX is really all numbers the quote thing was a red herring.

I just tried sending the integration data as a body parameter rather than sending it all as json and I get the "Invalid integration data" message.

How are you sending it in Postman?

Hi Peter,

I have been sending it as a parameter.  Looking at your previous curl I figured I'll need to send it through as data and see if that works. I had tried the quotes for the id and that hadn't made a difference.

If its as parameters, break the data bit out into the parameters.

This worked for me:

  curl -k $server/api/v1/courses/$course_id/assignment_groups/$assgrp_id \
   -X PUT \
   -F "integration_data[id]=123" \
   -F "integration_data[heading]=Some Heading" \
   -H "Authorization: Bearer $token"

View solution in original post

Ah that's the secret sauce I was looking for.  Work perfectly when I break up the parameters like that.  Thanks so much Peter.