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