Course Attachments API

creates video attachment from an video(mp4) file file

POST /api/v1/attachments/

Parameters

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

Request

Headers

Accept: application/json
X-Api-Token: XWkQCoBATVjUoatjrmH7M4w1SSVcTm8t4g
X-Api-Email: user-33@example.com

Route

POST /api/v1/attachments/

Body

{"id":89,"kind":"video","attachable_id":289,"attachable_type":"Course","file":{"url":"https://www.filepicker.io/api/file/ecPcZorTYauJQ59p0cge","filename":"small.mp4","mimetype":"video/mp4","size":383631,"key":"kkmxzLvQxSFndb1B3gk7_small.mp4","container":"lecture_attachments","path":"/uploads/small.mp4","isWriteable":true}}

cURL

curl "http://localhost:3000/api/v1/attachments/" -d '{"id":89,"kind":"video","attachable_id":289,"attachable_type":"Course","file":{"url":"https://www.filepicker.io/api/file/ecPcZorTYauJQ59p0cge","filename":"small.mp4","mimetype":"video/mp4","size":383631,"key":"kkmxzLvQxSFndb1B3gk7_small.mp4","container":"lecture_attachments","path":"/uploads/small.mp4","isWriteable":true}}' -X POST \
	-H "Accept: application/json" \
	-H "X-Api-Token: XWkQCoBATVjUoatjrmH7M4w1SSVcTm8t4g" \
	-H "X-Api-Email: user-33@example.com" \
	-H "Content-Type: application/json" \
	-H "Host: school.worksonmy.computer"

Response

Headers

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

Status

201 Created

Body

{
  "created_at": "2019-10-31T22:07:37Z",
  "code_syntax": null,
  "content_type": "video/mp4",
  "audio_type": "video/mp4",
  "should_be_uploaded_to_wistia?": true,
  "data": null,
  "schema": null,
  "text_constructor": null,
  "full_url": "http://school.worksonmy.computer/courses/289",
  "url": "https://www.filepicker.io/api/file/ecPcZorTYauJQ59p0cge",
  "host_id": null,
  "source": "user",
  "kind": "video",
  "name": "small.mp4",
  "host": "filepicker",
  "position": 1,
  "attachable_id": 289,
  "is_published": true,
  "downloadable": false,
  "text": null,
  "attachable_type": "Course",
  "thumbnail_url": null,
  "meta": {
    "class": "attachment",
    "url": null,
    "name": "small.mp4",
    "description": "",
    "image_url": null
  },
  "embeddable": true,
  "id": 90,
  "plain_text_html": ""
}