Attachments API

can create gradded quiz when supported by school

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: YXzjVBL3D5AQkoBGi4SUTzEZ4vbgnByRRw
X-Api-Email: user-350@example.com

Route

POST /api/v1/attachments/

Body

{"attachable_id":45,"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":45,"attachable_type":"Lecture","data":{"graded":true},"kind":"quiz","schema":{"type":"object","required":null,"properties":{}}}' -X POST \
	-H "Accept: application/json" \
	-H "X-Api-Token: YXzjVBL3D5AQkoBGi4SUTzEZ4vbgnByRRw" \
	-H "X-Api-Email: user-350@example.com" \
	-H "Content-Type: application/json" \
	-H "Host: school.worksonmy.computer"

Response

Headers

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

Status

201 Created

Body

{
  "created_at": "2019-10-31T22:01:13Z",
  "code_syntax": null,
  "content_type": null,
  "audio_type": null,
  "should_be_uploaded_to_wistia?": false,
  "data": {
    "graded": true
  },
  "schema": {
    "type": "object",
    "required": null,
    "properties": {
    }
  },
  "text_constructor": null,
  "full_url": "http://school.worksonmy.computer/courses/142/lectures/45",
  "url": null,
  "host_id": null,
  "source": "user",
  "kind": "quiz",
  "name": null,
  "host": null,
  "position": 1,
  "attachable_id": 45,
  "is_published": true,
  "downloadable": false,
  "text": null,
  "attachable_type": "Lecture",
  "thumbnail_url": null,
  "meta": {
    "class": "attachment",
    "url": null,
    "name": null,
    "description": "",
    "image_url": null
  },
  "embeddable": false,
  "id": 28,
  "plain_text_html": ""
}