Create Live Event
To create a new live event 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/event/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"?>
<event>
<title><![CDATA[Event Title]]></title>
<account><![CDATA[ACCOUNT]]></account>
<stream><![CDATA[STREAM KEY]]></stream>
<description><![CDATA[descriptive text]]></description>
<summary><![CDATA[summarizing text]]></summary>
<category><![CDATA[category]]></category>
<tags>
<tag>api</tag>
</tags>
<image>
<url><![CDATA[FULLY ENCODED URL TO LOCATION OF IMAGE FILE]]></url>
<alt><![CDATA[text for alt tag on image (optional)]]></alt>
<title><![CDATA[Title for image (optional)]]></title>
</image>
<schedule>
<timezone><![CDATA[America/Chicago]]></timezone>
<startDate><![CDATA[2013-10-10 9:55pm]]></startDate>
<endDate><![CDATA[2013-10-10 11:05pm]]></endDate>
<weeks>2</weeks>
<repeats>Mon, Wed, Fri</repeats>
</schedule>
<archive>
<recording_enabled>true</recording_enabled>
<end_record_date><![CDATA[2013-07-09 15:00]]></end_record_date>
<save_days>7</save_days>
<segment_length>1</segment_length>
<segment_tag><![CDATA[eventtitlepart]]></segment_tag>
</archive>
</event>
The minimum required items to successfully create a live event are: title, stream id and, start date, but as much information that is available can be provided. Wrap all text in CDATA markup. If a parameter is not available or in use, omit the node.
<account> The account the live event will be associated with. ONLY valid if the API user is associated with multiple accounts.
<stream> The key of the stream that will carry the live event. Find the stream key using sending an API get request to https://api.field59.com/v2/event/stream/info.
<category> Categories: (automotive, business, culture, education, entertainment, games, health, information, lifestyle, news, politics, religion, shopping, sports, technology, travel, weather). Default is news.
<tag> Keywords for the live event.
<timezone> The timezone of the startDate and endDate parameters.
Valid values: one of http://www.php.net/manual/en/timezones.php
Default: UTC
Example: America/Chicago
<startDate> Start date and time of the event.
Valid values: any valid PHP date format; see http://www.php.net/manual/en/datetime.formats.date.php
Example: 2013-10-17 10pm
<endDate> End date and time of the event.
Valid values: see start parameter
Default: none
<weeks> The number of weeks to repeat the event
Default: none (repeats until the end of time)
<repeats> The days of the week on which the event occurs.
Valid values: Mon, Tue, Wed, Thu, Fri, Sat, Sun (comma- or space-delimited)
Default: none (event does not repeat)
Example: Mon, Wed, Fri
<recording_enabled> Indicates whether an event will be recorded and available as VOD.
Valid values: “true” or “1”, “false” or “0”
Default: none
<end_record_date> Only valid for events without an endDate.
Valid values: see start parameter
Default: none
<save_days> The number of days to save the recorded video
Default: 7
<segment length> Maximum number of hours for parts of a recorded event. For events longer than this, multiple videos will be recorded.
Default: 1
<segment_tag> Keyword attached to recorded video if it is broken into parts. This facilitates searching and playlist creation.
Default: none
Response
If the live event has been successfully registered, the server will respond with a 200 OK response, and an XML response with a event node containing the key of the newly created event 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>
<event>
<key><![CDATA[FILE KEY]]></key>
</event>
<actions>
<postUpdatedEventInfo>https://api.field59.com/v2/event/[FILE KEY]</postUpdatedEventInfo>
<deleteEvent>https://api.field59.com/v2/event/[FILE KEY]</deleteEvent>
<getEventInfo>https://api.field59.com/v2/event/[FILE KEY]</getEventInfo>
<getEventSchedule>https://api.field59.com/v2/event/schedule/[FILE KEY]</getEventSchedule>
</actions>
</createresponse>
Code Example
In PHP, use curl to make the request.
<?php
try{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<event>
<title><![CDATA[Video Title]]></title>
<stream><![CDATA[STREAM ID]]></stream>
<schedule>
<timezone><![CDATA[America/Chicago]]></timezone>
<startDate><![CDATA[2013-10-10 9:55pm]]></startDate>
</schedule>
</event>';
$url = 'https://api.field59.com/v2/event/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@606754d4 = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@606754d4);
curl_close($ch);
} catch (Exception $e) {
var_dump($e);
}
Get Live Event Info
To get information about a live event in the system, make a GET request from the following url:
https://api.field59.com/v2/event/[FILE KEY]
Request
GET /v2/event/[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"?>
<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>
<archive>
<recording_enabled>true</recording_enabled>
<end_record_date><![CDATA[2013-07-09 15:00]]></end_record_date>
<save_days>7</save_days>
<segment_length>1</segment_length>
<segment_tag><![CDATA[eventtitlepart]]></segment_tag>
</archive>
</event>
Code Example
In PHP using curl to make the request:
<?php
try{
$url = 'https://api.field59.com/v2/event/[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@606754d4 = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@606754d4);
} catch (Exception $e) {
var_dump($e);
}
Get Live Event Schedule
To get the schedule for a repeating live event, make a GET request from the following url:
Request
GET /v2/event/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"?>
<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>
<instance>
<begin><![CDATA[2013-10-15 02:00]]></begin>
<end><![CDATA[2013-10-15 03:00]]></end>
</instance>
<instance>
<begin><![CDATA[2013-10-16 02:00]]></begin>
<end><![CDATA[2013-10-16 03:00]]></end>
</instance>
</schedule>
</event>
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';
$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@606754d4 = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@606754d4);
} catch (Exception $e) {
var_dump($e);
}
Update Live Event
To update an existing live event record, make a POST request to this URL:
https://api.field59.com/v2/event/[FILE KEY]
Request
This request is otherwise identical to the Create Live Event 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. All URLs should be URL-encoded. If a parameter is not available or in use, omit the node.
Delete Live Event
To delete a live event record, make a DELETE request to this URL:
https://api.field59.com/v2/event/[FILE KEY]
Request
DELETE /v2/event/[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/event/[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@606754d4 = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@606754d4);
} catch (Exception $e) {
var_dump($e);
}
Get Stream Keys
To get a list of streams for your account, make a GET request to this URL:
https://api.field59.com/v2/event/stream/info
Request
GET /v2/event/stream/info 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/event/stream/info';
$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@606754d4 = curl_getinfo($ch);
print_r($content);
print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@606754d4);
} catch (Exception $e) {
var_dump($e);
}
Response
<?xml version="1.0"?>
<streams>
<account><![CDATA[ACCOUNT]]></account>
<stream>
<key><![CDATA[daadd544b9cfd8e94d929f200226ac9c0e100000]]></key>
<title><![CDATA[Stream 1 Name]]></title>
</stream>
<stream>
<key><![CDATA[daadd544b9cfd8e94d929f200226ac9c0e122222]]></key>
<title><![CDATA[Stream 2 Name]]></title>
</stream>
</streams>