Modifying the basic properties of a Clip.
support, ws.webtv, api, clips, modify
GET vars specific to this request:
Var | Value | Description |
go | clips | The API section |
do | modify | The API action |
iq | Clip ID | Clip ID |
Resulting Request URL:
The resulting request URL would be similar to this (don't forget to append the required info: key, timestamp, salt and signature):
https://....../api.php?go=clips&do=modify&iq={clip_id}&{required information}
The following POST vars are optional.
Var | Value | Description |
id_user | (int) ID User | In case you want to change the ownwership, provide the ID of the new owner. |
title | (string) title | [Up to 255 characters] The title for the Clip. |
title_url | (string) slug | [Up to 255 characters] The slug is used on friendly URLs. If not provided it will be create from the title |
status | (int) status | Possible values: 0 (inactive), 1 (active) |
is_featured | (int) 0|1 | Whether the Clip is featured or not. |
type | (int) type | Possible values: 0 (standard), 1 (StreamClip VOD), 2 (StreamClip Live), 3 (EmbedClip), 4 (Auto-Encoding). |
description | (string) description | The Clip description. Can conatin HTML code |
description_seo | (string) short description | [Up to 255 characters] A shortened, plain text, version of the description used for SEO and for displaying on search results or lists |
tags | (string) tags | Clip tags, separated by comma. |
aspect | (float) aspect ratio | The aspect ratio of the Clip/Video. Possible values: 1.78 (TV 16:9), 0.56 - 9:16 (Portrait), 1.33 (TV 4:3), 1.37 (35mm), 1.66 (35mm), 1.75 (35mm), 1.85 (35mm), 2.35 (35mm Anamorphic) |
duration | (int) seconds | The duration of the Clip, in seconds. |
is_skippable | (int) 0|1 | Whether the Clip will be skippable or not. |
is_skippable_after | (int) seconds | If skippable, after how many seconds it can be skipped. |
socialize | (int) 0|1 | Whether to enable the sharing options for the Clip or not. |
allow_comments | (int) 0|1 | Whether to allow comments for the Clip. |
is_visitable | (int) 0|1 | Whether the Clip can be visited using its URL or not (in this last case, it will only playback in a Channel). |
is_searchable | (int) 0|1 | Whether the Clip can be "found" in the WebTV (in searches, lists, widgets, RSS feeds, etc.) or not. |
is_indexable | (int) 0|1 | Whether to allow search engines indexing the Clip or not. |
date | (int) timestamp | Date of the Clip (Unix timestamp) |
id_import | (string) Import ID | [Up to 14 character] If you are importing a Clip/Video from another site/system you may want to associate the external ID to the Clip. |
id_imdb | (string) IMDB ID | The IMDB ID if applicable. |
is_360 | (int) 0|1 | Whether the Clip is 360º. |
is_3d | (int) 0|1|2 | Whether the Clip is 3D.
Possible values: 0 (No), 1 (Yes, Lef/Right), 2 (Yes, Top/Bottom - Only applicable for 360 videos). |
is_deletable_only_by_admin | (int) 0|1 | Default value 0 (No). When set equal to 1 (Yes), the Clip will only be deletable by an Admin User even if it was created by an User with "Author" or "Contributor" access level. NOTE: This variable is available since WS.WebTV 2.4. |
future_date_auto_activation | (int) 0|1 | Requires: Scheduler extension, the Clip status must be "inactive" and a future date. Default value 0 (No). When set equal to 1 (Yes), the Clip will be automatically activated on the specified date. NOTE: This variable is available since WS.WebTV v53pf3. |
Custom fields (+info) - Since WS.WebTV 3.0.2pf3 | ||
fieldName | (mixed) field value | Each custom field must be passed as POST variable |
If the request was successful, you'll receive a response containing:
• ok: If the Clip was modified successfully.
Example:
{ "ok": "The Clip was modified" }
If the request failed (for example, if the Clip ID is invalid), you'll receive a response like the following:
{ "error": "CLIP_NOT_FOUND", "error_long": "It was not possible to find a Clip with the supplied ID" }
Possible Error Messages
Besides the general errors, this request can return the following errors:
• REQUEST_ERROR | Invalid Clip ID:
The Clip ID is not valid.
• CLIP_NOT_FOUND | It was not possible to find a Clip with the supplied ID:
The Clip was not found.
• MODIFICATION_ERROR | {Message}
It was not possible to modify the Clip because of the specified reason.
Preparing GET and POST data.
// The GET vars $GET_VARS = array( "go" => "clips", "do" => "modify", "iq" => 696 ); // The POST vars $POST_VARS = array( "id_user" => 1, "title" => "My Clip", "status" => 1, // active "is_featured" => 0, // not featured "type" => 0, // standard "description" => "This is the Clip description", "description_seo" => "This is the clip description", "tags" => "tag1, tag2, tag3", "aspect" => 1.78, // 16:9 "duration" => 105, // 1m45s "is_skippable" => 1, // is skippable "is_skippable_after" => 0, // after 0 sec "socialize" => 1, // enable sharing options "allow_comments" => 1, // enable comments "is_visitable" => 1, // is visitable "is_searchable" => 1, // is searchable "is_indexable" => 1, // is indexable "date" => 1473178807, // Sep 6 2016, 16:20:07 GMT "id_import" => "" );
Generating the salt, timestamp, signature and sending the request
*** The following code block is common to all signed requests ***
// Collect the API Base URL and Credential info $API_URL = "https://www.mywebtvdomain.tv/api.php"; $API_KEY_ID = "1b323a1cb879fd4e66530fbad07a32ee"; $API_SHARED_SECRET = "MWIzMjNhMWNiODc5ZmQ0ZTY2NTMwZmJhZDA3YTMyZWViOTQ3MDJiOGM2ZTU2NjE3"; // keep this safe!!! // Generating salt and timestamp $salt = md5(mt_rand()); $timestamp = time(); $signature = base64_encode(hash_hmac('sha256', $salt.$timestamp, $API_SHARED_SECRET, true)); // Generating the validation signature // - Default method: using base64_encode(hash_hmac(...)) $signature = base64_encode(hash_hmac('sha256', $salt.$timestamp, $API_SHARED_SECRET, true)); // comment this line if using the next method // - Simplified method - available since v60: using md5(). // This method requires the variable $API_SIGNATURE_GENERATION_MODE = 1; in the config/Config.inc.php file. // $signature = md5($salt."-".$timestamp."-".$API_SHARED_SECRET); // you must "uncomment" this line when using the simplified method // Append the timestamp, salt, key and signature to the GET vars $GET_VARS["timestamp"] = $timestamp; // UTC timestamp $GET_VARS["salt"] = $salt; $GET_VARS["key"] = $API_KEY_ID ; // The API Key ID: This is public and is used by the API to identify the application; $GET_VARS["signature"] = $signature; // Create the request URL. Please note that if you do not use PHP buit in function // to create the HTTP query then don't forget to URL encode the values $REQUEST_URL = $API_URL."?".http_build_query($GET_VARS); // The previous will build an URL like .../api.php?go=api_subject&do=api_action&etc... // Create a new cURL resource and set the appropriate options $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $REQUEST_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $POST_VARS); // If your PHP host does not have a valid SSL certificate, you will need to turn off SSL // Certificate Verification. This is dangerous (!), and should only be done temporarily // until a valid certificate has been installed curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Turns off verification of the SSL certificate. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Turns off verification of the SSL certificate. // Sending the request to the API $response = curl_exec($ch); // Processing the response if (!$response) { echo 'API call failed'; } else { print_r(json_decode($response,true)); }