Uploading videos through our HTTP API

  Requirements

Please ensure that you have created a video library prior to attempting a video upload, this will cause the upload to fail if an incorrect library ID is provided in the API call. You can find the steps to doing this via Step 1 of the guide linked: Uploading your first video through our website

This can also be done using our API, at the HTTP call: Add Video Library - docs.bunny.net

1. Obtaining your API key

To upload a video through our HTTP API, you will require the API key that will allow you to submit the required requests to allow the upload of your video. This can be found within the Stream panel, within a library under 'API'. You will want to copy the Read/Write API Key for this to work. Please leave this page open as it is required for steps further on in this guide.

Tf1sZ.png

2. Creating a video

Prior to uploading a video, you would first have to create the video. Please ensure to do this as it is a common mistake to attempt an upload before creating the video object. The exact parameters can be found on our documentation website found here: Create Video - docs.bunny.net

Your library ID can be found on the API documentation page as listed in Step 1, or can be returned via the 'List Video Libraries' API call found here: List Video Libraries - docs.bunny.net

The title of the video is what you would like the title of your video upload to be, the collectionId parameter is if you wish to upload the video to a specific collection ID.

hQziW.png

3. Uploading the video

Now you have created a library and a video, it is time to upload the actual video content. The parameters for this can be found here: Upload Video - docs.bunny.net

The libraryId can be found under the 'API' tab as described in steps 1 and 2, this will specify which library the video is contained in.

fdXqu.png

The videoId can be located within the video card itself in our control panel under 'Video ID' - or if created via our API, the 'guid' response would be the videoId.

UyOyL.png

🚧 What type of data needs to be added as the file body

Please note that the file body needs to be the video object itself in an unencoded binary format. You will not be able to upload an encoded mp4 file for example, if using cURL the binary of a file can be passed using the --data-binary parameter.

4. Fetching videos

We understand that some customers may wish to fetch an encoded copy of a video from a 3rd party source, for example a file storage platform or a web server. We have built in an API call for this called 'Fetch Video' which will allow you to do this. The documentation link to this can be found here: Fetch Video - docs.bunny.net

The parameters are much the same as a standard upload as described in step 3, however the 'url' parameter will allow you to enter a remote URL for our API to grab the encoded video from and then pass to the Stream platform.

3CTzt.png

 

 

 

Table of Contents

Was this article helpful?
14 out of 15 found this helpful