### Error Response Example Source: https://claravine.readme.io/reference/get-pick-list This snippet shows an example of an error response from the API, indicating a specific issue like a list not being found. ```APIDOC ## GET /websites/claravine_readme_io ### Description This endpoint is used to retrieve information about a specific website configuration within Claravine. It can be used to fetch details or check the status of a website integration. ### Method GET ### Endpoint /websites/claravine_readme_io ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier for the website configuration. ### Request Example ``` GET /websites/claravine_readme_io?id=your_website_id ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the data was retrieved. - **data** (object) - Contains the website configuration details. #### Error Response (404) - **message** (string) - A message describing the error, e.g., "The requested list was not found.". - **error** (string) - An error code, e.g., "LIST_NOT_FOUND". #### Response Example (Error) ```json { "message": "The requested list was not found.", "error": "LIST_NOT_FOUND" } ``` ``` -------------------------------- ### Error Response Example (HTTP) Source: https://claravine.readme.io/reference/audio-transcription This example illustrates an HTTP error response, specifically a 500 Internal Server Error, that might be returned during API interactions. It includes standard HTTP headers and a JSON body with an error message. ```http HTTP/1.1 500 Internal Server Error Date: Tue, 18 Apr 2022 17:19:44 GMT Content-Type: application/json Content-Length: 35 Connection: keep-alive Apigw-Requestid: DlWfjgcSliAEP1Q= {"message":"Internal Server Error"} ``` -------------------------------- ### Format and Send Create Transaction POST Request in Python Source: https://claravine.readme.io/discuss/64fbb14d9ace28006f3e1704 This Python code snippet demonstrates how to construct and send a POST request to the Claravine API for creating transaction data. It includes setting up the URL, headers with authentication and data fields, and making the request using the 'requests' library. The example highlights a common issue where 'fields' and 'rows' might be incorrectly formatted as lists instead of strings or bytes, leading to an error. ```python import requests url = "https://api.claravine.com/v1/datasets/xxx/dataset/data" headers = { "accept": "application/json", "x-claravine-key": "xxx", "x-claravine-secret": "xxx", "fields": fields, # Ensure 'fields' is a string or bytes "rows": rows # Ensure 'rows' is a string or bytes } # Example data (replace with your actual data) fields = "column1,column2" rows = "value1,value2\nvalue3,value4" try: response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.text) except requests.exceptions.RequestException as e: print(f"Error making request: {e}") if hasattr(e, 'response') and e.response is not None: print(f"Response status code: {e.response.status_code}") print(f"Response text: {e.response.text}") ``` -------------------------------- ### Authentication Error Example Source: https://claravine.readme.io/reference/list-pick-lists This section details the structure of an authentication error response from the Claravine API. ```APIDOC ## GET /example/endpoint ### Description This endpoint demonstrates an example of an authentication error response. ### Method GET ### Endpoint /example/endpoint ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for this example." } ``` ### Response #### Success Response (401) - **error** (string) - The error code, e.g., "UNAUTHENTICATED". - **message** (string) - A human-readable message explaining the error. #### Response Example ```json { "error": "UNAUTHENTICATED", "message": "Please authenticate and try again." } ``` ``` -------------------------------- ### Netra Callback JSON Example Source: https://claravine.readme.io/reference/content-similarity This JSON object represents a callback from the Netra service. It includes metadata about a video asset and a 'similar-videos' field that lists related video assets with their similarity scores. ```json { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2023-05/1177965-a24006810000478eabcd4ae97e593e88/mp4/cms3-CNN-exp-g7-big-questions-marc-stewart-live-051710aseg1-cnni-world-primary-272885-1177965-1920x1080_8000k.mp4", "title": "", "description": "", "tags": "", "duration": "00:01:10", "content-type": "video", "summary": { "iab-categories": { "News & Politics": { "International News": 78, "National News": 13, "Disasters": 5, "War & Conflict": 2 } }, "safety": { "risk": "Low", "garm-categories": {}, "flagged-scenes": {} }, "activities": { "interviewing": 97 }, "objects": { "Person": { "Man": 86 }, "Electronics": { "Television": 10 }, "House": { "Countertop": 2 } }, "emotions": { "Fear": 29, "Disgust": 23, "Sadness": 20, "Anger": 11, "Trust": 5 }, "places": { "Living Room": 95, "Historical Place": 4 }, "affinities": { "Political Junkies": 38, "Family-Focused": 36, "Green Living Enthusiasts": 13, "Avid Investors": 8 } }, "similar-videos": { "6b78dc12-eb34-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-03/678195-6a1c74e74f65431fa9ed9373a01c2e3a/mp4/cms3-CNN-ukraine-nuclear-plant-video-zaporizhzhia-tsr-vpx-primary-169458-678195-1920x1080_8000k.mp4", "score": 67 }, "19e0c344-f613-11ed-871e-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2023-05/1177965-a24006810000478eabcd4ae97e593e88/mp4/cms3-CNN-exp-g7-big-questions-marc-stewart-live-051710aseg1-cnni-world-primary-272885-1177965-1920x1080_8000k.mp4", "score": 64 }, "52df9042-eb34-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-03/679905-fadd2d8f2c0146878784f88b57f0e29b/mp4/cms3-CNN-let-it-go-frozen-kyiv-shelter-ukraine-ac360-wknd-sot-intl-ovn-vpx-primary-169726-679905-1920x1080_8000k.mp4", "score": 64 }, "9d064dde-eb32-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-05/760439-be93b43c65a04ddfa443744b7b5efc98/mp4/cms3-CNN-ukraine-steel-plant-mariupol-russia-explosions-ath-vpx-primary-183141-760439-1920x1080_8000k.mp4", "score": 67 }, "0813cc0a-eb33-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-04/741594-020a278f1f9c4a0a9cab8623845b97e6/mp4/cms3-CNN-shanghai-lockdown-footage-steven-jiang-intl-ldn-vpx-primary-179791-741593-1920x1080_8000k.mp4", "score": 63 }, "2b1cd948-eb34-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-03/691023-93322a39f46f4d2d8f027386a0600949/mp4/cms3-CNN-zelensky-message-russian-troops-ukraine-intl-ovn-sot-vpx-primary-171665-691023-1920x1080_8000k.mp4", "score": 67 }, "0b9b4c2c-eb33-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-04/741081-487eef6c7f1c4a63a6eafb97245cae6e/mp4/cms3-CNN-moskva-russian-warship-final-moments-phil-black-sot-tsr-vpx-primary-179714-741081-1920x1080_8000k.mp4", "score": 68 }, "54930446-eb34-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-03/679556-0299e0de2b2f49de9a6f7ca7b037af2a/mp4/cms3-CNN-irpin-ukraine-russian-missile-nrwknd-vpx-primary-169692-679556-1920x1080_8000k.mp4", "score": 66 }, "24e0516a-eb32-11ed-9be4-901b0ecc4ec5": { "url": "https://clips-media-aka.warnermediacdn.com/cnn/clips/2022-05/774078-2806e6570c51437bb6616cebaf859b51/mp4/cms3-CNN-russian-border-ukrainian-unit-melissa-bell-bts-nr-vpx-primary-185727-774071-1920x1080_8000k.mp4", "score": 61 } } } ``` -------------------------------- ### GET List Pick Lists Source: https://claravine.readme.io/reference/list-pick-lists Retrieves a collection of all Pick Lists accessible to the authenticated user. The response includes summary information for each list and a direct link (href) to fetch the full details of any individual list. ```APIDOC ## GET /lists/picklists ### Description Get information about all available Pick Lists. The response contains a `href` link for each list, which can be used to make requests and fetch the complete data of a single list. ### Method GET ### Endpoint /lists/picklists ### Parameters #### Query Parameters None ### Request Example ```json { "example": "No request body for GET request" } ``` ### Response #### Success Response (200) - **data** (array) - An array of pick list objects. - **id** (string) - The unique identifier for the pick list. - **name** (string) - The name of the pick list. - **href** (string) - A URL to retrieve the full details of this specific pick list. #### Response Example ```json { "data": [ { "id": "pl_12345abcde", "name": "Product Categories", "href": "/lists/picklists/pl_12345abcde" }, { "id": "pl_67890fghij", "name": "Region Codes", "href": "/lists/picklists/pl_67890fghij" } ] } ``` #### Error Response (401) - **message** (string) - Error message indicating unauthorized access. #### Error Response Example ```json { "message": "Authentication failed. Please provide valid API credentials." } ``` ### Notes - The default rate limit is 30 requests per minute, indicated by `X-RateLimit-Limit` and `X-RateLimit-Remaining` response headers. - API keys and secrets are generated in The Data Standards Cloud UI and inherit the permissions of the user who created them. ``` -------------------------------- ### OpenAPI Definition for Get Transaction Status Source: https://claravine.readme.io/reference/get-transaction-status This OpenAPI 3.1.0 definition outlines the 'Get Transaction Status' endpoint. It specifies the request method (GET), parameters (path and header), and possible responses including success (200) and error codes (400, 401). ```json { "openapi": "3.1.0", "info": { "title": "claravine-api-1", "version": "1.3.0" }, "servers": [ { "url": "https://api.claravine.com" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "in": "header", "name": "x-claravine-key" }, "sec1": { "type": "apiKey", "in": "header", "name": "x-claravine-secret" } } }, "security": [ { "sec0": [], "sec1": [] } ], "paths": { "/v1/datasets/{datasetUuid}/transactions/{transactionUuid}/status": { "get": { "summary": "Get Transaction Status", "description": "Get the current status of a transaction. May return a status of 'Pending', 'Complete', or 'Failed'.", "operationId": "get-transaction-status", "parameters": [ { "name": "X-RateLimit-Limit", "in": "header", "description": "Number of requests allowed per minute.", "schema": { "type": "integer", "format": "int32" } }, { "name": "X-RateLimit-Remaining", "in": "header", "description": "Number of requests available in the current minute.", "schema": { "type": "integer", "format": "int32" } }, { "name": "datasetUuid", "in": "path", "schema": { "type": "string", "default": "datasetUuid" }, "required": true }, { "name": "transactionUuid", "in": "path", "schema": { "type": "string", "default": "transactionUuid" }, "required": true } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Transaction State": { "value": "{\n \"status\": \"COMPLETED\"\n}" } }, "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "COMPLETED" } } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"error\": \"string\",\n \"message\": \"string\"\n}" } }, "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "string" }, "message": { "type": "string", "example": "string" } } } } } }, "401": { "description": "401", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"error\": \"UNAUTHENTICATED\",\n \"message\": \"Please authenticate and try again.\"\n}" } }, "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "UNAUTHENTICATED" }, "message": { "type": "string", "example": "Please authenticate and try again." } } } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true } ``` -------------------------------- ### POST /v73/summary Source: https://claravine.readme.io/reference/summary-endpoint This endpoint processes a video from a given source URL and returns a comprehensive summary. It allows for the inclusion of various extracted data points like scenes, emotions, objects, and more. Note: `include_scenes=True` is recommended only for smaller videos (under 5 minutes) due to potential data size. ```APIDOC ## POST /v73/summary ### Description Processes a video from a given source URL and returns a comprehensive summary. It allows for the inclusion of various extracted data points like scenes, emotions, objects, and more. Note: `include_scenes=True` is recommended only for smaller videos (under 5 minutes) due to potential data size. ### Method POST ### Endpoint `/v73/summary` ### Parameters #### Query Parameters - **include_scenes** (boolean) - Optional - Set to `True` to include scene information. Recommended for videos under 5 minutes. #### Request Body - **title** (string) - Required - The title for the video summary. - **description** (string) - Required - A description for the video summary. - **callback_urls** (array of strings) - Required - A list of URLs to receive webhook notifications. - **source_url** (string) - Required - The URL of the video to process. - **include_emotions** (boolean) - Optional - Set to `true` to include emotion data. - **include_affinities** (boolean) - Optional - Set to `true` to include affinity data. - **include_objects** (boolean) - Optional - Set to `true` to include object data. - **include_places** (boolean) - Optional - Set to `true` to include place data. - **include_activities** (boolean) - Optional - Set to `true` to include activity data. - **include_scenes** (boolean) - Optional - Set to `true` to include scene data. - **include_logos** (boolean) - Optional - Set to `true` to include logo data. - **include_demographics** (boolean) - Optional - Set to `true` to include demographic data. ### Request Example ```json { "title": "test summary ", "description": "test description", "callback_urls": ["http://api.webhookinbox.com/i/VXSx2Z2t/in/"], "source_url": " https://vid.test.com/870a128b-0f94-47dc-9fb7-eecdd6a85e2c/1080_h264.mp4", "include_emotions": true, "include_affinities":true, "include_objects":true, "include_places":true, "include_activities":true, "include_scenes":true, "include_logos":true, "include_demographics":true } ``` ### Response #### Success Response (200) - **scenes** (object) - Detailed information about scenes in the video, including iab-categories, activities, emotions, affinities, places, objects, safety, logos, and demographics. #### Response Example ```json { "scenes": { "00:00:00": { "iab-categories": { "Technology & Computing": { "Computer Animation": 91, "Computer Networking": 1 } }, "activities": { "spraying": 51 }, "emotions": { "Neutral": 39 }, "affinities": { "Mobile Enthusiasts": 6 }, "places": { "Fields": 3 }, "objects": { "Vehicle": { "Wheel": 3 } }, "safety": { "risk": "Low" }, "logos": { "HBO": 5 }, "demographics": { "No Human presence": 16 } }, "00:00:01": { // ... more scene data } } } ``` ``` -------------------------------- ### Generate Video Summary (cURL) Source: https://claravine.readme.io/reference/summary-endpoint This snippet demonstrates how to generate a video summary using a cURL request. It includes essential headers like Authorization and Content-Type, and specifies various parameters to include in the summary, such as emotions, objects, places, activities, scenes, logos, and demographics. The `include_scenes` parameter is recommended for shorter videos. ```curl curl -X POST 'https://vod2.netra-video.com/v73/summary' -H "Content-Type: application/json" -H "Authorization: Bearer ibcoXzqOVfsB7dcOUk7VIy375X0e4WrN" -d '{"title" : "test summary ", "description" : "test description", "callback_urls" : ["http://api.webhookinbox.com/i/VXSx2Z2t/in/"], "source_url" : " https://vid.test.com/870a128b-0f94-47dc-9fb7-eecdd6a85e2c/1080_h264.mp4", "include_emotions" : true, "include_affinities":true, "include_objects":true, "include_places":true, "include_activities":true, "include_scenes":true, "include_logos":true, "include_demographics":true }' ``` -------------------------------- ### Example Python Script for Claravine API Source: https://claravine.readme.io/docs/submitting-naming-conventions-for-validation A Python script demonstrating how to extract data from Prisma, format it, and submit it to Claravine's 'Create Transaction' endpoint using the provided API key and secret. ```APIDOC ```python import requests API_KEY = "your_key" API_SECRET = "your_secret" DATASET_UUID = "your_dataset_uuid" ENDPOINT = f"https://api.claravine.com/v1/datasets/{DATASET_UUID}/data" headers = { "X-API-KEY": API_KEY, "X-API-SECRET": API_SECRET, "Content-Type": "application/json" } data = { "transactionName": "Prisma Naming Push", "fields": ["Campaign Name", "Region", "Channel"], "rows": [ ["ACME_Q2_YT_US", "US", "YouTube"], ["ACME_Q2_FB_UK", "UK", "Facebook"] ] } response = requests.post(ENDPOINT, headers=headers, json=data) if response.status_code == 201: tx_id = response.json().get("transactionUuid") print("Submitted successfully. Transaction ID:", tx_id) else: print("Submission failed:", response.status_code, response.text) ``` ``` -------------------------------- ### GET /v1/datasets/{datasetUuid}/transactions/{transactionUuid}/status Source: https://claravine.readme.io/reference/get-transaction-status Retrieves the current status of a specified transaction within a dataset. The status can indicate if the transaction is 'Pending', 'Complete', or 'Failed'. ```APIDOC ## GET /v1/datasets/{datasetUuid}/transactions/{transactionUuid}/status ### Description Get the current status of a transaction. May return a status of 'Pending', 'Complete', or 'Failed'. ### Method GET ### Endpoint `/v1/datasets/{datasetUuid}/transactions/{transactionUuid}/status` ### Parameters #### Path Parameters - **datasetUuid** (string) - Required - The unique identifier for the dataset. - **transactionUuid** (string) - Required - The unique identifier for the transaction. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **status** (string) - The current status of the transaction (e.g., 'COMPLETED'). #### Response Example ```json { "status": "COMPLETED" } ``` #### Error Response (400) - **error** (string) - A general error code. - **message** (string) - A detailed error message. #### Error Response Example (400) ```json { "error": "string", "message": "string" } ``` #### Error Response (401) - **error** (string) - The error code, typically 'UNAUTHENTICATED'. - **message** (string) - A message indicating the authentication issue. #### Error Response Example (401) ```json { "error": "UNAUTHENTICATED", "message": "Please authenticate and try again." } ``` > 📘 Notes > The default rate limit is 100 requests per minute, which is shown through the response headers X-RateLimit-Limit and X-RateLimit-Remaining. > API keys and secrets are generated in The Data Standards Cloud UI, and they are given the same permissions as the user who created them. Talk to your CSM for additional information. ``` -------------------------------- ### Initialize and Fetch Claravine Data (Python) Source: https://claravine.readme.io/docs/gather-data-and-write-to-a-csv This Python code block handles the initialization and data fetching logic for the Claravine script. It checks for necessary API credentials and dataset UUID, prompts the user for data retention preference (all or most recent), and then calls functions to fetch transaction data. It relies on environment variables or hardcoded values for API keys and UUID, and user input for processing choice. ```python if __name__ == "__main__": if (API_KEY == '' or API_SECRET == '' or DATASET_UUID == ''): error_msg = f"[ERROR] Please edit the first lines of the script and provide values for: 'API_KEY', 'API_SECRET' and 'DATASET_UUID'." raise RuntimeError(error_msg) headers = { 'accept': 'application/json', 'x-claravine-key': API_KEY, 'x-claravine-secret': API_SECRET } choice = input("Do you want to keep [A]ll transactions or only the [M]ost recent per 'Claravine ID'? (A/M): ").strip().lower() keep_all = choice == 'a' transactions = fetch_transactions(DATASET_UUID, headers, START_DATE, END_DATE) data, columns = fetch_transaction_data(DATASET_UUID, transactions, headers) process_and_save_data(data, columns, DATASET_UUID, keep_all=keep_all) ``` -------------------------------- ### API Response Example: List Not Found (JSON) Source: https://claravine.readme.io/reference/update-pick-list This snippet demonstrates a typical JSON response when a requested list cannot be found. It includes a type and an example error code. ```json { "error": { "type": "string", "example": "LIST_NOT_FOUND" } } ``` -------------------------------- ### JSON Error Response Example Source: https://claravine.readme.io/reference/get-transaction-data This example demonstrates a typical JSON error response from the Claravine API. It includes an error code and a descriptive message. This response is common when authentication fails or other issues prevent request processing. ```json { "error": "UNAUTHENTICATED", "message": "Please authenticate and try again." } ``` -------------------------------- ### Handle API Authentication and Dataset UUID Source: https://claravine.readme.io/docs/template-data-dictionary This code block handles the initial setup for interacting with the Claravine API. It checks for required environment variables (DOMAIN, API_KEY, API_SECRET) and retrieves the dataset UUID, either from command-line arguments or by prompting the user via a terminal menu. It raises a RuntimeError if essential configuration is missing. ```python import sys if __name__ == '__main__': if (DOMAIN == '' or API_KEY == '' or API_SECRET == ''): error_msg = f"[ERROR] Please edit the first lines of the script and provide values for: 'DOMAIN', 'API_KEY' and 'API_SECRET'." raise RuntimeError(error_msg) # Get dataset UUID try: dataset_uuid = sys.argv[1] except IndexError: dataset_uuid = select_from_terminal_menu() print(f"Selected dataset UUID: {dataset_uuid}") ``` -------------------------------- ### Generate Data Dictionary CSV with Pandas Source: https://claravine.readme.io/docs/template-data-dictionary This Python script uses the Pandas library to create a data dictionary. It defines row names, transposes a DataFrame, and saves the result to a CSV file without headers. Ensure Pandas is installed (`pip install pandas`). ```python import pandas as pd # ... (previous code) row_names = [ "Field Type", "List ID", "List Name", "List Last Updated At", "List Column ID", "List Column Name" ] + [f"value_{i+1}" for i in range(max_values)] transposed_df.index = row_names[:len(transposed_df)] # Save to CSV transposed_df.to_csv(output_file_path, header=False) print("Finished processing all template fields and list values. Data Dictionary can be seen at: " + output_file_path) ``` -------------------------------- ### Create Creative Request (cURL) Source: https://claravine.readme.io/reference/creatives-endpoint This snippet demonstrates how to create a creative using the Netra Video API via cURL. It includes the necessary headers, endpoint, and a JSON payload with various parameters for analysis, such as emotions, affinities, objects, places, activities, scenes, logos, and demographics. The source URL for the video and callback URLs for notifications are also specified. ```curl curl -X POST 'https://vod2.netra-video.com/v73/creatives' -H "Content-Type: application/json" -H "Authorization: Bearer ibcoXzqOVfsB7dcOUk7VIy375X0e4WrN" -d '{"title" : "test ", "description" : "test description", "callback_urls" : ["http://api.webhookinbox.com/i/VXSx2Z2t/in/"], "source_url" : " https://vid.test.com/870a128b-0f94-47dc-9fb7-eecdd6a85e2c/1080_h 264.mp4", "include_emotions" : true, "include_affinities":true, "include_objects":true, "include_places":true, "include_activities":true, "include_scenes":true, "include_logos":true, "include_demographics":true }' ``` -------------------------------- ### Claravine API Validation Error Examples Source: https://claravine.readme.io/reference/update-pick-list Examples of validation errors returned by the Claravine API. These errors indicate issues with the data submitted, such as file size, file type, list headers, encoding, or column IDs. ```json { "message": "Invalid payload. The file may not be greater than 1536 kilobytes.", "error": "VALIDATION_ERROR" } ``` ```json { "message": "Invalid payload. The file must be a file of type: application/json.", "error": "VALIDATION_ERROR" } ``` ```json { "message": "Invalid list headers. Drop-down lists can't have more than 1 column.", "error": "INVALID_LIST_HEADERS" } ``` ```json { "message": "The file contains characters that are not encoded in UTF-8.", "error": "INVALID_ENCODING" } ``` ```json { "message": "The uploaded file contains invalid column ids.", "error": "INVALID_COLUMN_ID" } ``` -------------------------------- ### POST /v73/summary Source: https://claravine.readme.io/reference/summary-endpoint Classify Publisher Media Content by posting URLs to videos or images, or by posting text. Associated metadata can also be provided. ```APIDOC ## POST /v73/summary ### Description Post URLs to videos or images (or post text) to classify content along with associated metadata when available. ### Method POST ### Endpoint https://vod2.netra-video.com/v73/summary ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **source_url** (string) - Required - Link to the content file to be processed. Please ensure this link is valid (e.g., `http://some/video.mp4`.) - **text_input** (string) - Optional - To process text rather than image or video, use `text_input` in place of `source_url` - **callback_url** (array[string]) - Required - Link to the callback server. This must be a valid URL for video processing (e.g., `http://callback/url/`). Can support multiple callback URLs. - **title** (string) - Optional - The content title text, if available; e.g., `My little pony`. (default: "empty") - **description** (string) - Optional - Content description, if available; e.g., `Friendship is magic…`. (default: "empty") - **tags** (string) - Optional - Content tags separated by commas; e.g., `toys, children, animation`. (default: "empty") - **extra_data** (string) - Optional - Custom field for data inclusion and association with the asset to be processed. This value is a pass-through and isn’t used for categorization or processing. Supports alphanumeric characters. (default: "empty") - **include_scenes** (boolean) - Optional - Includes a scene-level collection of objects, places, and safety, etc. We recommend only using scenes for shorter videos; longer videos might lead to unwieldy large JSON objects. (default: false) - **include_tos** (boolean) - Optional - Includes the text-on-screen that is visible throughout the video as part of the video processing and categorization. (default: false) - **include_objects** (boolean) - Optional - Includes the [objects](https://docs.google.com/spreadsheets/u/2/d/1pRq0Mqu4lhe-P-1O4EHDxqnHgO8b2BhYJBxX5Gs63U0/edit) visible within the videos ordered by their frequency of appearance. The objects associated with each content are obtained using visual analysis. (default: false) - **include_affinities** (boolean) - Optional - Includes [affinities](https://docs.google.com/spreadsheets/u/2/d/1pRq0Mqu4lhe-P-1O4EHDxqnHgO8b2BhYJBxX5Gs63U0/edit) associated with this content. (default: false) - **include_emotions** (boolean) - Optional - Includes the [emotions](https://docs.google.com/spreadsheets/u/2/d/1pRq0Mqu4lhe-P-1O4EHDxqnHgO8b2BhYJBxX5Gs63U0/edit) spectrum detected within the videos. Emotions are based on the [Plutchik wheel of emotions](https://en.wikipedia.org/wiki/Robert_Plutchik). (default: false) - **include_places** (boolean) - Optional - Includes the places detected within the videos. (default: false) ### Request Example ```json { "source_url": "http://example.com/video.mp4", "callback_url": ["http://mycallback.com/handler"], "title": "Sample Video", "description": "A sample video for testing.", "tags": "test, video", "extra_data": "user_123", "include_scenes": true, "include_tos": false, "include_objects": true, "include_affinities": false, "include_emotions": true, "include_places": true } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request. - **message** (string) - A message providing details about the request status. - **job_id** (string) - The unique identifier for the processing job. #### Response Example ```json { "status": "success", "message": "Job successfully created.", "job_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### Select Claravine Template from Terminal Menu (Python) Source: https://claravine.readme.io/docs/template-data-dictionary This Python function fetches all available Claravine templates, formats them for display in a terminal menu, and allows the user to select one. It uses the `fetch_all_templates` function (assumed to be defined elsewhere) and the `TerminalMenu` library to provide an interactive selection experience. The function returns the UUID of the chosen template. ```python from terminal_menu import TerminalMenu def select_from_terminal_menu(): templates_available = fetch_all_templates() # Assumes this function is defined elsewhere # Create formatted display strings menu_entries = [ f"Name: '{name}', UUID: '{uuid}'" for name, uuid in templates_available ] # Create a mapping from display string to UUID display_to_uuid = { entry: uuid for entry, (_, uuid) in zip(menu_entries, templates_available) } terminal_menu = TerminalMenu( menu_entries, # Show formatted entries title="Type to filter ↓ | ↑/↓ to navigate | Enter to select:", search_key=None, # Enable search by typing any character preview_command="echo 'Selected Template: {}'", preview_size=0.3, cycle_cursor=True, clear_screen=True ) selected_entry = terminal_menu.show() dataset_uuid = display_to_uuid[menu_entries[selected_entry]] return dataset_uuid ``` -------------------------------- ### Update Pick List JSON Payload Example Source: https://claravine.readme.io/reference/update-pick-list An example of a valid JSON payload structure for updating a non-powered pick list. This payload can be used to modify the list's name, type, notes, headers, and rows. Ensure the JSON adheres to the specified format for successful updates. ```json { "name": "New Name", "type": "drill-down", "notes": "Updated from the Data Standards Cloud API", "headers": [ { "name": "First Column" }, { "name": "Second Column" } ], "rows": [ { "row_number": 0, "row_data": [ { "value": "New Value" }, { "value": "World" } ] }, { "row_number": 1, "row_data": [ { "value": "Claravine" }, { "value": "Lorem Ipsum" } ] } ] } ``` -------------------------------- ### Python Script to Create Claravine Template Data Dictionary Source: https://claravine.readme.io/docs/template-data-dictionary This Python script generates a data dictionary for Claravine templates. It requires the 'requests', 'pandas', and 'simple_term_menu' libraries. Users must configure their Claravine domain, API key, and API secret. The script can fetch all templates or a specific one using a dataset UUID, outputting the data dictionary as a CSV file. ```python import os import sys import csv import requests import pandas as pd from datetime import datetime from simple_term_menu import TerminalMenu '''TODO: Edit the following lines to use your values''' DOMAIN = '' # Account domain (e.g. 'account1.claravine.com') API_KEY = '' # Claravine API Key API_SECRET = '' # Claravine API Secret '''End of lines to be eddited''' # Set headers and URL HEADERS = { 'accept': 'application/json', 'x-claravine-key': API_KEY, 'x-claravine-secret': API_SECRET } # Fetch all list values from columns in template def get_all_list_data(template_data, domain, headers): list_column_values = dict() list_metadata = dict() # First, we fetch all list_column_ids that are being used and group by their list_id for field in template_data['template_fields']: if field['field']['list_governance']: list_id = field['field']['list_governance']['list_id'] if list_id not in list_column_values: list_column_values[list_id] = dict() col_id = field['field']['list_governance']['list_column_id'] list_column_values[list_id][col_id] = set() # Then, we call GET v1/lists/{listId} for each list, to fetch all list values and filter by the columns being used by the template for list_id, column_ids in list_column_values.items(): url = f"https://{domain}/v1/lists/{list_id}/" response = requests.get(url, headers=headers) if response.status_code != 200: error_msg = f"[ERROR] An unexpected error happened during the GET {url} request. Message:", response.text raise RuntimeError(error_msg) list_data = response.json() for row in list_data['rows']: for cell in row['row_data']: if (cell['col_id'] in list_column_values[list_id]): list_column_values[list_id][cell['col_id']].add(cell['value']) # Store list metadata list_metadata[list_id] = { 'name': list_data.get('name', ''), 'updated_at': list_data.get('updated_at', ''), 'columns': {header['col_id']: header['name'] for header in list_data.get('headers', [])} } return list_column_values, list_metadata # Call GET /v1/datasets/ endpoint to retrieve all templates names and UUIDs def fetch_all_templates(): datasets_url = f"https://{DOMAIN}/v1/datasets/" datasets_response = requests.request("GET", datasets_url, headers=HEADERS) if (datasets_response.status_code != 200): error_msg = f"[ERROR] An unexpected error happened during the GET {datasets_url} request. Message:", datasets_response.text raise RuntimeError(error_msg) # Filter only names and UUIDs return [[template['name'], template['uuid']] for template in datasets_response.json()['datasets']] ```