Zobjects are additional, customizable metadata that you can create and associate with videos. Simple examples of Zobjects are actors, directors, or artists.
Since Zobjects can be used to create any metadata association you need, you first need to create a Zobject type to define the data structure.
Creating a Zobject Type using the API
This example will outline how to create a new Zobject type to hold the name of Film directors and a list of Films. Afterward, we will create Zobject instances for each director.
To create a new Zobject type you will use the Create Zobject Type endpoint.
curl --request POST \ --url https://api.zype.com/zobject_types
In the payload, we are going to add a title, a description, a flag to establish if the Zobject instances can be associated with videos, and 2 custom attributes, each instance will have:
- Full Name - as a String
- Films - as an Array
The payload will look something like this:
"description": "Description of the Zobject, for example films Directors",
"description": "this sample field to hold the name of the director"
"description": "this array will hold the name of some films from the director"
Note that the parameter for custom attributes is zobject_attributes_attributes.
The data type available are:
Now we have our new Zobject type available in the Zobject types section:
The new Zobject Type details view will look like this on the admin:
Creating Zobjects using the API
Now that we have our Zobject Type we can create entrees or Zobjects for each director.
Same as with types, Zobjects can be created from the Zype admin in the Metadata section on the left navigation, and we have a guide outlining how to do that HERE.
To create a new zobject type we use the Create Zobject endpoint.
curl --request POST \ --url https://api.zype.com/zobjects
In the payload, we need to add the Zobject type and we are going to add a title, description, set it as active, and fill the custom parameter in the ZobjecType.
Note that spaces on the title the Zobject type will get replaced by an underscore "_"
The payload would look something like this:
"description": "zobject for quentin tarantino",
"full_name": "Quentin Tarantino",
"film": "Reservoir Dogs, Pulp Fiction, Kill Bill, Django Unchained"
You can now create new Zobjects for each director. You can also associate this Zobject to the videos from the director.
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