creates video attachment from an video(mp4) file file
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
Route
POST /api/v1/attachments/
Body
{"attachable_id":40,"attachable_type":"Lecture","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 '{"attachable_id":40,"attachable_type":"Lecture","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: ZF31kVs8wAdx1B8NDVJb_NhfDh2TBfvBNA" \
-H "X-Api-Email: user-340@example.com" \
-H "Content-Type: application/json" \
-H "Host: school.worksonmy.computer"
Response
Headers
Status
201 Created
Body
{
"created_at": "2019-10-31T22:01:09Z",
"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/137/lectures/40",
"url": "https://www.filepicker.io/api/file/ecPcZorTYauJQ59p0cge",
"host_id": null,
"source": "user",
"kind": "video",
"name": "small.mp4",
"host": "filepicker",
"position": 1,
"attachable_id": 40,
"is_published": true,
"downloadable": false,
"text": null,
"attachable_type": "Lecture",
"thumbnail_url": null,
"meta": {
"class": "attachment",
"url": null,
"name": "small.mp4",
"description": "",
"image_url": null
},
"embeddable": true,
"id": 23,
"plain_text_html": ""
}