As I understand, one can use curl to make POST and PATCH requests;
POST: https://gist.github.com/subfuzion/08c5d85437d5d4f00e58
PATCH: How to use PATCH verb
For tus upload using the Vimeo API, it's a multi-step process:
Step 1 is the POST request to /me/videos
. If done correctly, you'll receive the full video response back, with an "upload"
object containing an "upload_link"
. Use the upload_link
value for Step 2.
(Note that the upload_link
should be on a Vimeo "tus" subdomain, like files.tus.vimeo.com
. If you get an upload_link
on a different Vimeo subdomain, then something went wrong with your request and the API is defaulting to another upload approach. You can also verify that you're getting a tus upload_link
returned by checking the approach
value nested in the upload
object, it should return "tus".)
From your example, --request
lacks the POST
verb/action. Step 1 should look like this (also note that -request
, -header
, and -data
are interchangeable with -X
, -H
, and -d
, respectively):
curl -X POST https://api.vimeo.com/me/videos \
-H 'Accept: application/vnd.vimeo.*+json;version=3.4' \
-H 'Authorization: bearer XXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '{"upload":{"approach":"tus","size":"999999"}}'
Step 2, the actual file upload, is a PATCH to the upload_link
returned from Step 1, with the request body containing the raw binary data of your video file:
curl --request PATCH upload_link \
-H 'Accept: application/vnd.vimeo.*+json;version=3.4' \
-H 'Content-Type: application/offset+octet-stream' \
-H 'Tus-Resumable: 1.0.0' \
-H 'Upload-Offset: 0' \
--data-binary /path/to/file.ext
Step 3 is a HEAD request to that same upload_link
, without the file data:
curl --request HEAD upload_link \
-H 'Accept: application/vnd.vimeo.*+json;version=3.4' \
-H 'Tus-Resumable: 1.0.0' \
Depending on the upload-length
and upload-offset
headers returned, you may need to repeat step 2, resuming the upload from the last byte on Vimeo's servers.
Documentation for Vimeo's tus upload implementation is found here: https://developer.vimeo.com/api/upload/videos#resumable-approach
Hope this points you in the right direction!