Create Playlist
To create a new playlist record, make a POST request to this URL:
Request
This request should contain a single parameter named “xml”. That parameter should contain an XML string with the information you want recorded into our system:
POST /v2/playlist/create HTTP/1.1
Content-Type: application/xml
Authorization: username:password
Host: api.field59.com
Expect: 100-continue
Smart playlist request
<playlist>
<type><![CDATA[smart]]></type>
<title><![CDATA[Smart Title]]></title>
<account><![CDATA[ACCOUNT]]></account>
<description><![CDATA[descriptive text]]></description>
<category><![CDATA[category]]></category>
<tags>
<tag>api</tag>
</tags>
<maxSize><![CDATA[10]]></maxSize>
</playlist>
Manual playlist request
<?xml version="1.0" encoding="UTF-8"?>
<playlist>
<type><![CDATA[manual]]></type>
<title><![CDATA[Manual Title]]></title>
<account><![CDATA[ACCOUNT]]></account>
<description><![CDATA[descriptive text]]></description>
<assets>
<asset><![CDATA[FILE KEY]]></asset>
<asset><![CDATA[FILE KEY]]></asset>
</assets>
</playlist>
Type and title are required for creation. Wrap all text in CDATA markup. If a parameter is not available or in use, omit the node.
<type> playlist type (smart or manual).
<account> The account the video will be associated with. ONLY valid if the API user is associated with multiple accounts.
<category> Smart ONLY. Categories of videos to include in this playlist (automotive, business, culture, education, entertainment, games, health, information, lifestyle, news, politics, religion, shopping, sports, technology, travel, weather). Default: all categories.
<tag> Smart ONLY. Keywords for videos to include in this playlist. Default: all keywords.
<maxSize> Smart ONLY. Number of videos to include in this playlist. Default: 10.
<asset> Manual ONLY. File key of video to include in this playlist. Order is maintained.
Response
If the playlist has been successfully created, the server will respond with a 200 OK response, and an XML response with a playlist node containing the key of the newly created playlist and links to available actions that can be followed by your application to perform subsequent actions.
HTTP/1.1 200 OK
<?xml version="1.0"?>
<createresponse>
<playlist>
<key><![CDATA[FILE KEY]]></key>
</playlist>
<actions>
<postUpdatedPlaylistInfo>https://api.field59.com/v2/playlist/[FILE KEY]</postUpdatedPlaylistInfo>
<deletePlaylist>https://api.field59.com/v2/playlist/[FILE KEY]</deletePlaylist>
<getPlaylistInfo>https://api.field59.com/v2/playlist/[FILE KEY]</getPlaylistInfo>
</actions>
</createresponse>
Code Example
In PHP, use curl to make the request.
<?php
try{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<playlist>
<type><![CDATA[smart]]></type>
<title><![CDATA[Playlist Title]]></title>
</playlist>';
$url = 'https://api.field59.com/v2/playlist/create';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "xml=" . $xml);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'username:password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
com.dotmarketing.util.ServletResponseCharacterEncoding@3ab6fcce = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@3ab6fcce);
curl_close($ch);
} catch (Exception $e) {
var_dump($e);
}
Get Playlist Info
To get information about a playlist in the system, make a GET request from the following url:
https://api.field59.com/v2/playlist/[FILE KEY]
Request
GET /v2/playlist/[FILE KEY][?timezone] HTTP/1.1
Content-Type: application/xml
Authorization: username:password
Host: api.field59.com
Expect: 100-continue
timezone: the timezone used to convert timestamps in results.
Valid values: one of http://www.php.net/manual/en/timezones.php
Default: UTC
Example: America/Chicago
Response
<?xml version="1.0"?>
<?xml version="1.0"?>
<playlist>
<timeZone><![CDATA[America/Chicago]]></timeZone>
<key><![CDATA[FILE KEY]]></key>
<type><![CDATA[manual]]></type>
<title><![CDATA[Manual Playlist Title]]></title>
<account><![CDATA[ACCOUNT]]></account>
<description><![CDATA[descriptive text]]></description>
<create_date><![CDATA[2013-10-01 16:15:41]]></create_date>
<last_update><![CDATA[2013-10-02 15:45:18]]></last_update>
<deleted></deleted>
<category><![CDATA[category (smart playlists ONLY)]]></category>
<maxSize><![CDATA[10 (smart playlists ONLY)]]></maxSize>
<filterAccounts>
<account><![CDATA[ACCOUNT (smart playlists ONLY)]]></account>
</filterAccounts>
<tags>
<tag><![CDATA[api] (smart playlists ONLY)]></tag>
</tags>
<assets>
<asset>
<timeZone><![CDATA[America/Chicago]]></timeZone>
<key><![CDATA[FILE KEY]]></key>
<package_type><![CDATA[field59_v4]]></package_type>
<title><![CDATA[conv]]></title>
<status><![CDATA[ready]]></status>
<source_url><![CDATA[VIDEO URL]]></source_url>
<account><![CDATA[ACCOUNT]]></account>
<category><![CDATA[category]]></category>
<description></description>
<create_date><![CDATA[2013-10-08 17:16:29]]></create_date>
<last_update><![CDATA[2013-10-08 17:19:10]]></last_update>
<deleted><![CDATA[]]></deleted>
<captions>
<embedded><![CDATA[1]]></embedded>
<sidecarUrl><![CDATA[CAPTION FILE URL]]></sidecarUrl>
</captions>
<thumbnail_image>
<key><![CDATA[FILE KEY]]></key>
<title><![CDATA[Title]]></title>
<url><![CDATA[IMAGE URL]]></url>
<alt></alt>
</thumbnail_image>
<transcodes>
<format>
<id><![CDATA[ID]]></id>
<format><![CDATA[fl9]]></format>
<title><![CDATA[Title]]></title>
<url><![CDATA[TRANSCODE URL]]></url>
<duration><![CDATA[17.74]]></duration>
</format>
</transcodes>
</asset>
</assets>
</playlist>
Code Example
In PHP using curl to make the request:
<?php
try{
$url = 'https://api.field59.com/v2/playlist/[FILE KEY]?timezone=America/Chicago';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'usernamehere:passwordhere');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
com.dotmarketing.util.ServletResponseCharacterEncoding@3ab6fcce = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@3ab6fcce);
} catch (Exception $e) {
var_dump($e);
}
Update Playlist
To update an existing playlist record, you will need to make a POST request to this URL:
https://api.field59.com/v2/playlist/[FILE KEY]
Request
This request is otherwise identical to the Create Playlist request. It should contain a single parameter named “xml”. That parameter should contain an XML string with the information you want recorded into our system. Wrap all text in CDATA markup. If a parameter is not available or in use, omit the node.
Delete Playlist
To delete a playlist record, make a DELETE request to this URL:
https://api.field59.com/v2/playlist/[FILE KEY]
Request
DELETE /v2/playlist/[FILE KEY] HTTP/1.1
Content-Type: application/xml
Authorization: username:password
Host: api.field59.com
Expect: 100-continue
Code Example
In PHP using curl to make the request:
<?php
try{
$url = 'https://api.field59.com/v2/playlist/[FILE KEY]';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'usernamehere:passwordhere');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$content = curl_exec($ch);
com.dotmarketing.util.ServletResponseCharacterEncoding@3ab6fcce = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@3ab6fcce);
} catch (Exception $e) {
var_dump($e);
}