If a video file is already online, it's possible to import it directly to the platform as a new source for a video already existing on the library using the file's URL and the API, This can be done using the Create Video Import endpoint.
Depending on the file size the import process might take from a few minutes to a few hours.
Note: The URL needs to point directly to the video file without redirects.
Importing the file
Note: If the file is already on the video import section (and is not attached already no a video) you can skip this step, you only need the asset's import id, which can be obtained using the List Video imports endpoint.
If you only have a single video, to import a file with Zype's API docs website, you need to head to the Video Import section, we are going to use the Create Video Import endpoint to send a POST Request which the only requirement is the URL of the video File and the admin API Key.
The request can be sent from the documentation itself, but there are also are working examples for cURL and different programming languages on how to use the endpoint.
Since we want to add/merge the import as a new source to a video already on the library we need to set the auto_add parameter as false
To create the sample request or send it from the docs:
- Enter your account's admin API key into the authentication box
- Enter the body parameters, in this exercise we want to import the video, added to the library, and have it transcoded as a Zype Hosted source.
- In the parameter source_url we include the URL of the video file.
- The parameter to_zype_hosted as true if the file is to be transcoded as a Zype Hosted asset.
- The parameter auto_add as false to prevent the import from being added as a new video to the library.
- Click the Try Button or copy the samples, cURL, NodeJS, Ruby PHP and Python are available.
The video file will be imported and downloaded to the platform as an async process, the import will be added as an import and we need to capture the id of the import retuned be the request.
"_id": "61116abe3a4e7d0001c0094c", <---- we are going to need this
Attach an Existing Video with our Import
Now we are going to merge our new import with the video we already have in our library, to that end we need the video's id (you can use the list videos endpoint to get the video id ) and the import id we got on the first step. We are going to create a PUT request with the Attach a Video to a Video Import endpoint
The parameters are:
- id: The Id of the import obtained on the previous step (or using the List Video imports endpoint)
- video_id: id of the video object already on the library
curl --request PUT \
--url https://api.zype.com/video_imports/61116abe3a4e7d0001c0094c/add_video \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
A sample curl request would look like this and our video object on the library will have a new source!
Was this article helpful?
Articles in this section
- How to Request a Video Player
- How to Merge a New Video Import to an Existing Video Using the API
- Importing a Single Video from a URL
- Ad Timings with the API
- Using the Upload API Endpoint
- Assigning Categories to Videos Using the API
- Creating New Subscriptions with the API
- Create zobjects with custom attributes using the API