Create Live Channel
To create a new live channel record, make a POST request to this URL:
https://api.field59.com/v2/channel/create
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/channel/create HTTP/1.1
Content-Type: application/xml
Authorization: username:password
Host: api.field59.com
Expect: 100-continue
<?xml version="1.0" encoding="UTF-8"?>
<channel>
<title><![CDATA[Channel Title]]></title>
<account><![CDATA[ACCOUNT]]></account>
<description><![CDATA[descriptive text]]></description>
<category><![CDATA[category]]></category>
<tags>
<tag>api</tag>
</tags>
</channel>
Title is required for creation. Wrap all text in CDATA markup. If a parameter is not available or in use, omit the node.
<account> The account the channel will be associated with. ONLY valid if the API user is associated with multiple accounts.
<category> Categories of events to include in this channel (automotive, business, culture, education, entertainment, games, health, information, lifestyle, news, politics, religion, shopping, sports, technology, travel, weather). Default: any category.
<tag> Keywords for events to include in this channel. Default: any keyword.
Response
If the channel has been successfully created, the server will respond with a 200 OK response, and an XML response with a channel node containing the key of the newly created channel 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>
<channel>
<key><![CDATA[FILE KEY]]></key>
</channel>
<actions>
<postUpdatedChannelInfo>https://api.field59.com/v2/channel/[FILE KEY]</postUpdatedChannelInfo>
<deleteChannel>https://api.field59.com/v2/channel/[FILE KEY]</deleteChannel>
<getChannelInfo>https://api.field59.com/v2/channel/[FILE KEY]</getChannelInfo>
<getChannelSchedule>https://api.field59.com/v2/channel/schedule/[FILE KEY]</getChannelSchedule>
</actions>
</createresponse>
Code Example
In PHP, use curl to make the request.
<?php
try{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<channel>
<title><![CDATA[News Channel]]></title>
<tags>
<tag>newscast</tag>
</tags>
</channel>';
$url = 'https://api.field59.com/v2/channel/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@4cb171ff = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@4cb171ff);
curl_close($ch);
} catch (Exception $e) {
var_dump($e);
}
Get Channel Info
To get information about a live channel in the system, make a GET request from the following url:
https://api.field59.com/v2/channel/[FILE KEY]
Request
GET /v2/channel/[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"?>
<channel>
<timeZone><![CDATA[America/Chicago]]></timeZone>
<key><![CDATA[FILE KEY]]></key>
<stream><![CDATA[Stream Name]]></stream>
<title><![CDATA[Channel 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]]></category>
<tags>
<tag><![CDATA[api]]></tag>
</tags>
<events>
<event>
<timeZone><![CDATA[UTC]]></timeZone>
<key><![CDATA[FILE KEY]]></key>
<title><![CDATA[API Test]]></title>
<stream><![CDATA[Stream Name]]></stream>
<description></description>
<summary></summary>
<create_date><![CDATA[2013-10-14 23:42:47]]></create_date>
<last_update><![CDATA[2013-10-14 23:42:47]]></last_update>
<category><![CDATA[category]]></category>
<tags>
<tag><![CDATA[api]]></tag>
</tags>
<schedule>
<startDate><![CDATA[2013-10-15 02:00]]></startDate>
<endDate><![CDATA[2013-10-15 03:00]]></endDate>
<endRepeat><![CDATA[2013-11-05]]></endRepeat>
<repeats><![CDATA[Tue, Wed]]></repeats>
</schedule>
</event>
</events>
</channel>
Code Example
In PHP using curl to make the request:
<?php
try{
$url = 'https://api.field59.com/v2/channel/[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@4cb171ff = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@4cb171ff);
} catch (Exception $e) {
var_dump($e);
}
Get Live Channel Schedule
To get the schedule of events that make up the live channel, make a GET request from the following url:
https://api.field59.com/v2/channel/schedule/[FILE KEY]
Request
GET /v2/channel/schedule/[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"?>
<channel>
<timeZone><![CDATA[America/Chicago]]></timeZone>
<key><![CDATA[FILE KEY]]></key>
<stream><![CDATA[Stream Name]]></stream>
<title><![CDATA[Channel 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]]></category>
<tags>
<tag><![CDATA[api]]></tag>
</tags>
<thumbnail_image>
<title><![CDATA[Stream Name]]></title>
<url><![CDATA[thumburl.png]]></url>
<alt><![CDATA[Stream Name]]></alt>
</thumbnail_image>
<schedule>
<instance>
<key><![CDATA[FILE KEY]]></key>
<title><![CDATA[API Test]]></title>
<startDate><![CDATA[2013-10-15 02:00]]></startDate>
<endDate><![CDATA[2013-10-15 03:00]]></endDate>
</instance>
</schedule>
</channel>
Code Example
In PHP using curl to make the request:
<?php
try{
$url = 'https://api.field59.com/v2/event/schedule/[FILE KEY]?timezone=America/Chicago&hours=12';
$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@4cb171ff = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@4cb171ff);
} catch (Exception $e) {
var_dump($e);
}
Update Channel
To update an existing channel record, make a POST request to this URL:
https://api.field59.com/v2/channel/[FILE KEY]
Request
This request is otherwise identical to the Create Live Channel 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 Channel
To delete a channel record, make a DELETE request to this URL:
https://api.field59.com/v2/channel/[FILE KEY]
Request
DELETE /v2/channel/[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/channel/[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@4cb171ff = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@4cb171ff);
} catch (Exception $e) {
var_dump($e);
}