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 "https://templeu.instructure.com/api/v1/sections/26524/enrollments" \
-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 "https://temple.instructure.com/api/v1/courses/27954/enrollments/444839" \
-X DELETE \
-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?