@evanrenselaar
The access token is allowed in the query string, but it's discouraged. Adding the access token to the header keeps it out of the query string, which may get logged, and accidentally disclose the token. In general, mixing query parameters and a body with a post action is normally frowned upon, even if the specification allows it.
The problem here is the format of your post body. You are trying to mix a JSON object with www-url-form-encoded requests. You need to do one or the other.
Matt showed you what it should look like and included the necessary content-type: application/json header. You may also want to include an accept: application/json header to let Canvas know it's okay to send a JSON response.
{ "assignment" : { "name" : "Erik Test", "description" : "TEST" } }
If you want to use the field-style format, then you would need set it up like this:
assignment[name]=Erik%20Test&assignment[description]=TEST
I'd recommend going with the JSON way. I create the entire object separately and then make it the value for the assignment key.
// assignmentObject contains the values needed
{ "assignment" : assignmentObject }
It depends on which REST library you're using as to whether you will need to convert that object to a JSON string before sending it.
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.