Once you've created categories to organize your videos and playlists, you will want to begin assigning these category values to your content. Review the developer tutorial below to assign the categories to your videos using our API.
For instructions on getting your API or app keys, see API and App Keys.
Update Video Endpoint
To add or update category values on videos, you will be using the update video endpoint from our API.
The payload will change depending on if you are adding a category and values to the video for the first time or if instead, you are updating the values of a category already associated with the video.
Adding a category and values to a video
To add a category and it's values to a video in your library we need to use the update video PUT Request.
Sample URL with API credential would look like this:
The Payload needs a top 'video' object and a then a 'categories_attributes' array with the category id and the values we want to add inside an array.
Sample JSON payload:
Updating a category value to a video already associated with a category
To update category values on a video already associated with the category, an extra parameter is required on the payload. This value is a unique identifier in the video-category relationship, which is unique for this specific video-category pair and can be found on the video object using the List Videos or View Video endpoints.
Sample JSON payload:
Note: Using the request without the "Video-Category" id on a video already associated with the intended category will result in a 422 error, even if no actual category values are selected for the video.
error 422 | "message": "Could not update video: Categories is invalid"
Where can I find the unique video-category identifier?
On the 'category' array of each video object, each element will have the unique video-category identifier ('_id'), the category id, and the values currently selected for the video for that category.
"_id": "5f592b64fdb9aa0001d04351", <- video_id
"_id": "5f592d2dda6f6800012c3b4f", <- video-category uid
"title": "My Category Title",
"_id": "5f592d2dda6f6800012c3b52", <- video-category uid
"title": "Audio Language",
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