Developer Key Course Edit/Course Delete

233 views
Skip to first unread message

tmda...@gmail.com

unread,
Jun 12, 2014, 3:30:29 PM6/12/14
to canvas-l...@googlegroups.com
Hey All,

Curious about this phenomena that I'm observing:  I have a developer key and I can create courses via the API.  When I try to edit or delete the courses via the API I get the same response: "user not authorized to perform that action."

Also, when I log into Canvas, I can't see the courses that I have created. 

Any insights?

Best,
TMD





tmda...@gmail.com

unread,
Jun 12, 2014, 3:33:59 PM6/12/14
to canvas-l...@googlegroups.com, tmda...@gmail.com
Example:

curl https://canvas.instructure.com/api/v1/courses/860554 \
  -X PUT \
  -H 'Authorization: Bearer <somethingawesome>' \
  -d 'course[name]=blarg'
 
{"status":"unauthorized","errors":[{"message":"user not authorized to perform that action"}]}

Chris Herdt

unread,
Jun 12, 2014, 3:51:46 PM6/12/14
to canvas-l...@googlegroups.com
You need to include your token as a header in the request. See https://canvas.instructure.com/doc/api/file.oauth.html

(Maybe you are including it but you redacted it from your message?)


--

---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Chris Herdt
Web Applications Developer
http://osric.com/chris/

Timothy Dalbey

unread,
Jun 12, 2014, 4:58:13 PM6/12/14
to canvas-l...@googlegroups.com, canvas-l...@googlegroups.com
Yea - the header has the token in it as per the example.
You received this message because you are subscribed to a topic in the Google Groups "Canvas LMS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/canvas-lms-users/wKM76SfnyVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to canvas-lms-use...@googlegroups.com.

Chris Herdt

unread,
Jun 12, 2014, 5:29:48 PM6/12/14
to canvas-l...@googlegroups.com
Sorry, I totally overlooked the token in your example! Don't know how I missed it.
Are you using the address of your Canvas install (not canvas.instructure.com)?

I was able to submit a similar request on my instance and it was successful (a course object was returned with the update applied):

curl -H 'Authorization: Bearer <REDACTED>'\
 https://myinstance.instructure.com/api/v1/courses/123456\
 -X PUT\
 -d 'course[name]=Foo'

tmda...@gmail.com

unread,
Jun 12, 2014, 5:36:20 PM6/12/14
to canvas-l...@googlegroups.com
I am indeed using hosted Canvas (aka canvas.instructure.com).  Otherwise, my request looks identical with exception to the the ordering of the arguments. 
Reply all
Reply to author
Forward
0 new messages