creates file attachment from an HTML 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":42,"attachable_type":"Lecture","file":{"url":"https://uploads.teachablecdn.com/yCsaLfIQQnCqW97IcWQF_html.html","filename":"html.html","mimetype":"text/html","size":15,"key":"yCsaLfIQQnCqW97IcWQF_html.html","container":"lecture_attachments","path":"/uploads/html.html","isWriteable":true}}
cURL
curl "http://localhost:3000/api/v1/attachments/" -d '{"attachable_id":42,"attachable_type":"Lecture","file":{"url":"https://uploads.teachablecdn.com/yCsaLfIQQnCqW97IcWQF_html.html","filename":"html.html","mimetype":"text/html","size":15,"key":"yCsaLfIQQnCqW97IcWQF_html.html","container":"lecture_attachments","path":"/uploads/html.html","isWriteable":true}}' -X POST \
-H "Accept: application/json" \
-H "X-Api-Token: MFxVCteKypvazMsZWB6A8z8rp5qHGW75Sg" \
-H "X-Api-Email: user-344@example.com" \
-H "Content-Type: application/json" \
-H "Host: school.worksonmy.computer"
Response
Headers
Status
201 Created
Body
{
"created_at": "2019-10-31T22:01:11Z",
"code_syntax": null,
"content_type": "text/html",
"audio_type": "text/html",
"should_be_uploaded_to_wistia?": false,
"data": null,
"schema": null,
"text_constructor": null,
"full_url": "http://school.worksonmy.computer/courses/139/lectures/42",
"url": "https://uploads.teachablecdn.com/yCsaLfIQQnCqW97IcWQF_html.html",
"host_id": null,
"source": "user",
"kind": "file",
"name": "html.html",
"host": "filepicker",
"position": 1,
"attachable_id": 42,
"is_published": true,
"downloadable": true,
"text": null,
"attachable_type": "Lecture",
"thumbnail_url": null,
"meta": {
"class": "attachment",
"url": null,
"name": "html.html",
"description": "",
"image_url": null
},
"embeddable": false,
"id": 25,
"plain_text_html": ""
}