Edit an assignment through API - assignment is missing

Jump to solution
NateBu
Community Member

I am having trouble with the API editing an assignment. I can create an assignment without any trouble by posting
this message
{assignment:{
  name:`${name}`,
  submission_type:'online_url',
  points_possible:...,
  published:...,
  due_at:...
}}

to  `https://${url}/api/v1/courses/${course_id}/assignments`;

I get back an assignment object and one of the fields is an integer labeled "id". I can check in canvas and the assignment is successfully created. However I can't edit, based on the documentation I've be trying to "PUT" a request e.g.

{assignment:{
  name:`${newname}`,
}}

to  `https://${url}/api/v1/courses/${course_id}/assignments/${assignment_id}`;

where assignment_id is the "id" I got back from the creation request.

When I do this I get the following response

{ errors: [ { message: 'assignment is missing' } ] }

Any ideas what I'm doing wrong? Thanks!

Labels (3)
0 Likes
1 Solution
NateBu
Community Member

Nevermind sorry, this works fine. My utility that called "fetch" in javascript was actually filtering out the body of my request

View solution in original post