Attachments API

cannot update a graded quiz when not supported by school

PATCH /api/v1/courses/:course_id/lectures/:lecture_id/attachments/:attachment_id

Parameters

Name Description
attachable_id the id of the object this should be attached to (Lecture/Course)
attachable_type type of the object (Lecture/Course)
file a filepicker file blob {url:, filename:, mimetype:, size:, key:,container:}
text the contents of a text/html attachment

Request

Headers

Accept: application/json
X-Api-Token: VzUAqTyc6-u_Tsnpeh9uyRoZnFmryw6mLA
X-Api-Email: user-336@example.com

Route

PATCH /api/v1/courses/134/lectures/37/attachments/21

Body

{"attachable_id":37,"attachable_type":"Lecture","data":{"graded":true,"answerKey":{"answer-1":["Correct"],"answer-2":["Correct"]}},"schema":{"type":"object","required":["answer-1","answer-2"],"properties":{"answer-1":{"enum":["Correct","Wrong1","Wrong2"],"type":"string","title":"First Question","description":"single"},"answer-2":{"enum":["Correct","Wrong1","Wrong2"],"type":"string","title":"Question 2","description":"single"}}}}

cURL

curl "http://localhost:3000/api/v1/courses/134/lectures/37/attachments/21" -d '{"attachable_id":37,"attachable_type":"Lecture","data":{"graded":true,"answerKey":{"answer-1":["Correct"],"answer-2":["Correct"]}},"schema":{"type":"object","required":["answer-1","answer-2"],"properties":{"answer-1":{"enum":["Correct","Wrong1","Wrong2"],"type":"string","title":"First Question","description":"single"},"answer-2":{"enum":["Correct","Wrong1","Wrong2"],"type":"string","title":"Question 2","description":"single"}}}}' -X PATCH \
	-H "Accept: application/json" \
	-H "X-Api-Token: VzUAqTyc6-u_Tsnpeh9uyRoZnFmryw6mLA" \
	-H "X-Api-Email: user-336@example.com" \
	-H "Content-Type: application/json" \
	-H "Host: school.worksonmy.computer"

Response

Headers

Content-Type: application/json; charset=utf-8
Content-Length: 84

Status

401 Unauthorized

Body

{
  "success": false,
  "error": "Unauthorized",
  "status": 401,
  "message": "You can't do that!"
}