AnsweredAssumed Answered

Canvas API

Question asked by Dushyant Tyagi on Jun 27, 2019
Latest reply on Jun 27, 2019 by Dushyant Tyagi

I was trying to extract module data for users on canvas using the following code. I got the error "

{"status":"unauthorized","errors":[{"message":"user not authorized to perform that action"}]}
Although the access token works for other purposes.

 

module_url = "https://REDACTED.instructure.com/api/v1/courses/60142/modules/"

Api_key = "REDACTED"
id_list = ["113048", "153863", "153864", "153865", "153866", "153868", "153869", "118132", "154826"]
NetId_list = {'student_id':'tma81'}

for i in id_list:
url1 = module_url+ str(i) +"/items"+ Api_key
response= requests.get(url1, params= NetId_list)
zf = json.loads(response.content)
Module1=pd.DataFrame(zf)
print(response.url)

Outcomes