Produkte und Dateien
Upload file
/ v1 / files Stores a file that buyers get, as content of a product or a lesson: for example a PDF, ZIP, video, audio or image. For images on a sales page, use POST /v1/images or put a URL into images.
There are two ways:
- Upload with PUT (preferred, up to 5 GB). Send
file_nameandsize_byteswithouturl. The answer has anupload_url. Send the bytes there with HTTP PUT, for example with curl, then callPOST /v1/files/{file_id}/finish. - Copy from a URL (up to 10 MB). Send
url, and Tentary copies the file from the public https URL at once. No finish step is needed. Use this only if you cannot send a PUT.
Larger files without PUT: the account owner uploads them in the Tentary app.
Then add the file to a content block of PATCH /v1/products/{product_id}, POST /v1/courses/{course_id}/lessons or PATCH /v1/lessons/{lesson_id}, for example {"type": "video", "file_id": ...}.
- Block types
image,videoandaudioshow the file in a player. Typefilegives a download, also for a video or an image. kindin the answer is the block type that fits the file.- Videos in a video block are converted for streaming. This takes some minutes.
See File uploads.
Autorisierung
-
Authorizationstring Header erforderlichBearer tnt_…· A personal API key (tnt_...). Create it in the Tentary app on the page AI & API. Einführung
Body application/json
-
urlstringPublic https URL of the file (at most 10 MB).
max. Länge
2048 -
file_namestringName with extension, like "Workbook.pdf". With url: optional (default from the URL).
max. Länge
250 -
size_bytesintegerWithout url: the exact file size.
min.
1max.5368709120
Antwort
Felder der Antwort mit Status 200. Fehler haben immer dasselbe Format, siehe Fehler.
Without url: the upload_url for the PUT. With url: the stored file.
Variante 1 von 2
-
file_idintegerCall finish_upload with it after the PUT.
-
upload_urlstring<uri>Send the bytes here with HTTP PUT, without extra headers.
-
methodstringThe HTTP method for the upload.
Mögliche Werte:
PUT -
expires_in_secondsintegerThe upload_url works this long.
-
next_stepstringWhat to do next (PUT, then finish_upload).
Variante 2 von 2
-
file_idintegerUse it in a content block.
-
namestringThe name.
-
file_typestringFile extension, like pdf.
-
kindstringThe content block type that fits the file.
Mögliche Werte:
imagevideoaudiofile -
size_bytesintegerFile size in bytes.