Authentication Required

paulwuhj
Community Novice

As the instructor for this particular course, when I typed a url like the following in the browser after I logon to Canvas:

https://canvas.xxxxx.edu/courses/1111/users/2222/usage.json?per_page=100 

I received a reply like the following:

while(1);[
{"asset_user_access":{"id":9402284,"asset_code":"context_external_tool_342",
"asset_group_code":"external_tools","user_id":44845,"context_id":11402,"context_type":
"Course","last_access":"2018-08-01T16:26:37Z","created_at":"2018-08-01T16:11:41Z",
"updated_at":"2018-08-01T16:26:37Z","asset_category":"external_tools","view_score":2.0,
"participate_score":null,"action_level":"view","display_name":"iBookstore","membership_type":
"StudentEnrollment","readable_name":"iBookstore","asset_class_name":"context_external_tool",
"icon":"icon-question"}},
{"asset_user_access":{"id":9399869,"asset_code":"home:course_11402",
"asset_group_code":"other","user_id":44845,"context_id":11402,"context_type":"Course",
"last_access":"2018-08-01T16:26:20Z","created_at":"2018-08-01T14:42:17Z",
"updated_at":"2018-08-01T16:26:20Z","asset_category":"home","view_score":3.0,
"participate_score":null,"action_level":"view","display_name":null,
"membership_type":"StudentEnrollment","readable_name":"Course Home","asset_class_name":null,
"icon":"icon-home"}}, ...

However, when I use python code to call the same url using the token I generated from my account. Instead I got the following response. 

<Response [401]> {     "status": "unauthenticated",     "errors": [         {             "message": "user authorization required"         }     ] }

Would anyone advise how to avoid getting this error code and be able to access the response in json file?

Thanks,

Paul

Labels (1)