Canvas API Error with user suspend

PedroFonseca
Community Member

Using the API we're having no problems at all creating students, enrolling them and fetching completions.

However, when changing a student from suspended to unsuspended (PUT action) I get the following error:

{"status":"unauthorized","errors":[{"message":"user not authorised to perform that action"}]}

The request is a PUT with an ContentType of "application/json" as follows:

{"user": { "suspend": false } }

 

Any hint on what we could be missing here?

For reference our (Java) code is as follows:

...

httpClient = HttpClientBuilder.create().build();
HttpPut putRequest = new HttpPut(base_u + query);
putRequest.addHeader("Authorization", "Bearer " + api_k);

StringEntity entity = new StringEntity(payload);
entity.setContentType("application/json");
putRequest.setEntity(entity);

response = httpClient.execute(putRequest);
HttpEntity resp_entity = response.getEntity();
String responseString = EntityUtils.toString(resp_entity, "UTF-8");
log(responseString);

...

 

 

Labels (1)
0 Likes