0

I am trying to upload a video file to vimeo using tus (as explained in link Video Uploads on Vimeo developers API

I am able to create a video file by adding authorization, accept and content-type field in header and also recommended body body. (as mentioned in link). e.g.

const header = {
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/vnd.vimeo.*+json;version=3.4',
        'Authorization': 'bearer ' + this.token
      }
    };

Body:

 const body = {
      "upload" : {
        "approach" : "tus",
        "size" : videoObj.size
      },
      "name" : videoObj.name
    };

Now I want to upload video file. I am using a simple method to open a video file. In the link, one line is making me confuse "PATCH the binary data of the video file to the URL from upload.upload_link, along with some custom tus headers:" . What does it mean?

upload.upload_link is what i get from a response while creating video object. Now I am trying to build a header and body object as shown.

 const header = {
      headers: {
        'Content-Type': 'application/offset+octet-stream',
        'Upload-Offset': 0,
        'Tus-Resumable': '1.0.0'
      }
    };

Now where to put upload.upload_link and make an api call again?

Umair Jameel
  • 1,573
  • 3
  • 29
  • 54

1 Answers1

1

upload.upload_link is the uri you want to make that PATCH request to. Be aware that the upload_link will have a different path than the API uris (api.vimeo.com), usually along the lines of upload.tus.vimeo.com.

Tommy Penner
  • 2,910
  • 1
  • 11
  • 16
  • In headers if I assign int 0 to Upload-Offset, it gives me error "missing or invalid Upload-Offset header". But if I add 0 as string, video uploads with response null. – Umair Jameel Sep 24 '18 at 18:30
  • The Upload-Offset value should be provided as an integer, not a string: https://tus.io/protocols/resumable-upload.html#upload-offset, https://developer.vimeo.com/api/upload/videos#step-2-upload-the-video-file. The video file itself should be provided in the request body as raw binary data: https://tus.io/protocols/resumable-upload.html#patch – Tommy Penner Sep 24 '18 at 18:40