AnsweredAssumed Answered

Getting Errors with REST API Delete for Sections

Question asked by Peter Hanley on Sep 18, 2017
Latest reply on Sep 25, 2017 by Peter Hanley

I'm having a couple problems using the REST API (via Canvaspest, but I'm also hitting it using CURL) to handle enrollments: 


This works fine:

curl -X POST "" \
-H "Authorization: Bearer supersecretblahblahblah" \
-F   "enrollment[user_id]=18" \
-F   "enrollment[type]=StudentEnrollment" \
-F   "enrollment[enrollment_state]=active" \
| jq --raw-output 


So for testing user enrollments, that works fine: 

  "id": 444839,
  "user_id": 18,
  "course_id": 27954,
  "type": "StudentEnrollment",
  "created_at": "2017-09-18T22:22:29Z",
  "updated_at": "2017-09-18T22:22:29Z",


But then this doesn't work:


curl "" \
-H "Authorization: Bearer supersecretblahblahblah" \
-F 'task=delete' \
| jq --raw-output 


Is the documentation wrong?  Both Enrollments - Canvas LMS REST API Documentation and the Canvas Live API indicate that the delete should work, but I get this error (and I've confirmed the tokens are identical, so it's not invald):


  "errors": [
      "message": "Invalid access token."


Am I just making a huge obvious mistake?