Create a metadata value
POST https://api.coactive.ai/api/v0/video-narrative-metadata/metadataContent-Type: application/jsonCreate a metadata value.
- Genre: The overall story category or narrative style of the content.
- Mood: The emotional tone or feeling the content creates.
- Subject: The main topic or theme the content focuses on.
- Format: The structural style or production type of the content.
Authentication
Section titled “Authentication”Authorizationheader (bearer token, required) — Bearer authentication of the formBearer <token>, where token is your auth token.
Request
Section titled “Request”Body (application/json)
Section titled “Body (application/json)”This endpoint expects an object.
metadata_type(enum, required) — Supported metadata types.- Allowed values:
genre,mood,subject,format
- Allowed values:
name(string, required)description(string, required)examples(list of string, required)
Response
Section titled “Response”Successful Response
item(object, required) — A metadata value.id(string, required)metadata_type(enum, required) — Supported metadata types.- Allowed values:
genre,mood,subject,format
- Allowed values:
name(string, required)description(string, required)examples(list of string, required)
Errors
Section titled “Errors”422 Unprocessable Entity Error
Section titled “422 Unprocessable Entity Error”Validation Error
detail(list of object, optional)loc(list of string or integer, required)msg(string, required)type(string, required)
Examples
Section titled “Examples”Request
{ "metadata_type": "genre", "name": "Action", "description": "A genre characterized by physical feats, stunts, combat, and high-paced sequences.", "examples": [ "Die Hard (1988)", "Terminator 2: Judgment Day (1991)", "The Matrix (1999)", "Gladiator (2000)", "The Dark Knight (2008)", "Inception (2010)", "Mad Max: Fury Road (2015)", "John Wick (2014)", "Mission: Impossible - Fallout (2018)" ]}Response
{ "item": { "id": "d4e5f678-9012-3456-ab56-f78901234567", "metadata_type": "genre", "name": "Action", "description": "A genre characterized by physical feats, stunts, combat, and high-paced sequences.", "examples": [ "Die Hard (1988)", "Terminator 2: Judgment Day (1991)", "The Matrix (1999)", "Gladiator (2000)", "The Dark Knight (2008)", "Inception (2010)", "Mad Max: Fury Road (2015)", "John Wick (2014)", "Mission: Impossible - Fallout (2018)" ] }}SDK Code
import requests
url = "https://api.coactive.ai/api/v0/video-narrative-metadata/metadata"
payload = { "metadata_type": "genre", "name": "Action", "description": "A genre characterized by physical feats, stunts, combat, and high-paced sequences.", "examples": ["Die Hard (1988)", "Terminator 2: Judgment Day (1991)", "The Matrix (1999)", "Gladiator (2000)", "The Dark Knight (2008)", "Inception (2010)", "Mad Max: Fury Road (2015)", "John Wick (2014)", "Mission: Impossible - Fallout (2018)"]}headers = { "Authorization": "Bearer <token>", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://api.coactive.ai/api/v0/video-narrative-metadata/metadata';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"metadata_type":"genre","name":"Action","description":"A genre characterized by physical feats, stunts, combat, and high-paced sequences.","examples":["Die Hard (1988)","Terminator 2: Judgment Day (1991)","The Matrix (1999)","Gladiator (2000)","The Dark Knight (2008)","Inception (2010)","Mad Max: Fury Road (2015)","John Wick (2014)","Mission: Impossible - Fallout (2018)"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.coactive.ai/api/v0/video-narrative-metadata/metadata"
payload := strings.NewReader("{\n \"metadata_type\": \"genre\",\n \"name\": \"Action\",\n \"description\": \"A genre characterized by physical feats, stunts, combat, and high-paced sequences.\",\n \"examples\": [\n \"Die Hard (1988)\",\n \"Terminator 2: Judgment Day (1991)\",\n \"The Matrix (1999)\",\n \"Gladiator (2000)\",\n \"The Dark Knight (2008)\",\n \"Inception (2010)\",\n \"Mad Max: Fury Road (2015)\",\n \"John Wick (2014)\",\n \"Mission: Impossible - Fallout (2018)\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}require 'uri'require 'net/http'
url = URI("https://api.coactive.ai/api/v0/video-narrative-metadata/metadata")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Post.new(url)request["Authorization"] = 'Bearer <token>'request["Content-Type"] = 'application/json'request.body = "{\n \"metadata_type\": \"genre\",\n \"name\": \"Action\",\n \"description\": \"A genre characterized by physical feats, stunts, combat, and high-paced sequences.\",\n \"examples\": [\n \"Die Hard (1988)\",\n \"Terminator 2: Judgment Day (1991)\",\n \"The Matrix (1999)\",\n \"Gladiator (2000)\",\n \"The Dark Knight (2008)\",\n \"Inception (2010)\",\n \"Mad Max: Fury Road (2015)\",\n \"John Wick (2014)\",\n \"Mission: Impossible - Fallout (2018)\"\n ]\n}"
response = http.request(request)puts response.read_bodyimport com.mashape.unirest.http.HttpResponse;import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.post("https://api.coactive.ai/api/v0/video-narrative-metadata/metadata") .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .body("{\n \"metadata_type\": \"genre\",\n \"name\": \"Action\",\n \"description\": \"A genre characterized by physical feats, stunts, combat, and high-paced sequences.\",\n \"examples\": [\n \"Die Hard (1988)\",\n \"Terminator 2: Judgment Day (1991)\",\n \"The Matrix (1999)\",\n \"Gladiator (2000)\",\n \"The Dark Knight (2008)\",\n \"Inception (2010)\",\n \"Mad Max: Fury Road (2015)\",\n \"John Wick (2014)\",\n \"Mission: Impossible - Fallout (2018)\"\n ]\n}") .asString();<?phprequire_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.coactive.ai/api/v0/video-narrative-metadata/metadata', [ 'body' => '{ "metadata_type": "genre", "name": "Action", "description": "A genre characterized by physical feats, stunts, combat, and high-paced sequences.", "examples": [ "Die Hard (1988)", "Terminator 2: Judgment Day (1991)", "The Matrix (1999)", "Gladiator (2000)", "The Dark Knight (2008)", "Inception (2010)", "Mad Max: Fury Road (2015)", "John Wick (2014)", "Mission: Impossible - Fallout (2018)" ]}', 'headers' => [ 'Authorization' => 'Bearer <token>', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();using RestSharp;
var client = new RestClient("https://api.coactive.ai/api/v0/video-narrative-metadata/metadata");var request = new RestRequest(Method.POST);request.AddHeader("Authorization", "Bearer <token>");request.AddHeader("Content-Type", "application/json");request.AddParameter("application/json", "{\n \"metadata_type\": \"genre\",\n \"name\": \"Action\",\n \"description\": \"A genre characterized by physical feats, stunts, combat, and high-paced sequences.\",\n \"examples\": [\n \"Die Hard (1988)\",\n \"Terminator 2: Judgment Day (1991)\",\n \"The Matrix (1999)\",\n \"Gladiator (2000)\",\n \"The Dark Knight (2008)\",\n \"Inception (2010)\",\n \"Mad Max: Fury Road (2015)\",\n \"John Wick (2014)\",\n \"Mission: Impossible - Fallout (2018)\"\n ]\n}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import Foundation
let headers = [ "Authorization": "Bearer <token>", "Content-Type": "application/json"]let parameters = [ "metadata_type": "genre", "name": "Action", "description": "A genre characterized by physical feats, stunts, combat, and high-paced sequences.", "examples": ["Die Hard (1988)", "Terminator 2: Judgment Day (1991)", "The Matrix (1999)", "Gladiator (2000)", "The Dark Knight (2008)", "Inception (2010)", "Mad Max: Fury Road (2015)", "John Wick (2014)", "Mission: Impossible - Fallout (2018)"]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.coactive.ai/api/v0/video-narrative-metadata/metadata")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.httpMethod = "POST"request.allHTTPHeaderFields = headersrequest.httpBody = postData as Data
let session = URLSession.sharedlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) }})
dataTask.resume()