Attachments API

cannot create gradded quiz when not supported by school plan

POST /api/v1/attachments/

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
text_constructor_attributes text constructor attributes

Request

Headers

Accept: application/json
X-Api-Token: moL4ydJyr3qUT1nNoB7FJA-cpM1k1uadsQ
X-Api-Email: user-352@example.com

Route

POST /api/v1/attachments/

Body

{"attachable_id":46,"attachable_type":"Lecture","data":{"graded":true},"kind":"quiz","schema":{"type":"object","required":null,"properties":{}}}

cURL

curl "http://localhost:3000/api/v1/attachments/" -d '{"attachable_id":46,"attachable_type":"Lecture","data":{"graded":true},"kind":"quiz","schema":{"type":"object","required":null,"properties":{}}}' -X POST \
	-H "Accept: application/json" \
	-H "X-Api-Token: moL4ydJyr3qUT1nNoB7FJA-cpM1k1uadsQ" \
	-H "X-Api-Email: user-352@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!"
}