To search for items, make a GET request to this URL:

https://api.field59.com/v2/search

Request


GET /v2/search[?querystring] HTTP/1.1
Accept: application/xhtml+xml
Authorization: username:password

Optional Querystring Parameters

type: type of item to search for.
Valid values: video, playlist, event
Default: video

terms: a comma- or space- (encoded as “%20%” or “+”) delimited list of search terms.
Default: none (all items are returned)
Example: terms=bike+popsicle

fields: a comma-delimited list of fields to search.
Valid values: title, tags, summary, description.
Default: none (all fields are searched)
Example: fields=tags,title

playlists: a comma-delimited list of playlist keys limiting the search. Ignored if type is not video.
Default: none (all videos are searched)
Example: playlists=8b0b938cb14b12a7847f35d283142fe2273b9630

deleted: if present, returns deleted items.
Default: false (deleted items are not returned)
Example: deleted=true

limit: maximum number of items to return.
Default: 25
Example: limit=10

skip: number of records to skip when returning results. Useful for pagination.
Default: 0
Example: skip=10

timezone: the timezone of the start and end parameters; timestamps in results are also converted to this timezone.
Valid values: one of http://www.php.net/manual/en/timezones.php
Default: UTC
Example: America/Chicago

start: beginning of date range limiting search.
Valid values: any valid PHP date format without spaces; see http://www.php.net/manual/en/datetime.formats.date.php
Default: today
Example: 2019-10-17

modifiedStart: beginning of date range limiting search by asset modified date.
Valid values: any valid PHP date format without spaces; see http://www.php.net/manual/en/datetime.formats.date.php
Default: none
Example: 2019-10-17

end: end of date range limiting search.
Valid values: see start parameter
Default: none

modifiedEnd: end of date range limiting search by asset modified date.
Valid values: see modifiedStart parameter
Default: none

sorting: sort order of the returned items; items are listed by date (ordered newest to oldest), relevance (ordered based on likelihood that the item is what the user is looking for), or last modified (ordered by most recently updated).
Valid values: date, relevance, modified
Default: date
Example: sorting=relevance

q: allows acceptance of a string that is passed to search directly. Follow the Associated Press’s syntax guide to construct queries using the valid values below. Other parameters, like “terms” & “fields”, are ignored if q is set. 

Valid values: title, tags (must say tags not keywords), description, summary, captions
Default: none
Example: tag:fire+category:news

Responses
Items from accounts that are associated with the logged-in user are returned. In the case that no items matched the search criteria, an empty node (videos, playlists, or events) is returned. Note: playlists node is only returned if the query included the playlists parameter.

Video response

HTTP/1.1 200 OK
<?xml version="1.0"?>
<videos>
      <timeZone><![CDATA[UTC]]></timeZone>
      <video>
            <key><![CDATA[FILE KEY]]></key>
            <title><![CDATA[Title]]></title>
            <category><![CDATA[culture]]></category>
            <tags>
                  <tag><![CDATA[farmers]]></tag>
            </tags>
            <url><![CDATA[VIDEO URL]]></url>
            <adaptive_stream><![ADAPTIVE URL]]></url>
            <duration><![CDATA[0:09]]></duration>
            <summary>[CDATA[Summary]]</summary>
            <description>[CDATA[Description]]</description>
            <thumb><![CDATA[FULL-SIZE IMAGE URL]]></thumb>
            <thumb><![CDATA[SMALL IMAGE URL]]></thumbSmall>
            <thumb><![CDATA[MEDIUM IMAGE URL]]></thumbMedium>
            <playlists>
            <playlist><![CDATA[Playlist Key]]></playlist>
            </playlists>
            <createDate><![CDATA[2019-10-14 23:38:06]]></createDate>
<lastModifiedDate><![CDATA[2019-10-14 23:38:06]]></lastModifiedDate>
<liveDate><![CDATA[2019-10-14 23:38:06]]></liveDate> <owner><![CDATA[Account]]></owner> <user><![CDATA[User]]></user> <id><![CDATA[525c805e3a228dd822b2363d]]></id> </video> <video>...<video> </videos>

Playlist response

HTTP/1.1 200 OK
<?xml version="1.0"?>
<playlists>
      <timeZone><![CDATA[UTC]]></timeZone>
      <playlist>
            <key><![CDATA[FILE KEY]]></key>
            <title><![CDATA[Smart Playlist]]></title>
            <category><![CDATA[lifestyle]]></category>
            <tags/>
            <summary><![CDATA[test]]></summary>
            <thumb><![CDATA[IMAGE URL]]></thumb>
            <type><![CDATA[smart]]></type>
            <createDate><![CDATA[2019-10-14 23:10:19]]></createDate>
            <owner><![CDATA[Account]]></owner>
            <user><![CDATA[User]]></user>
            <id><![CDATA[525c79dbc39a66851060941a]]></id>
      </playlist>
      <playlist>...</playlist>
</playlists>

Live Event response

HTTP/1.1 200 OK
<?xml version="1.0"?>
<events>
       <timeZone><![CDATA[UTC]]></timeZone>
       <event>
             <key><![CDATA[FILE KEY]]></key>
             <title><![CDATA[Event title]]></title>
             <stream><![CDATA[STREAM NAME]]></stream>
             <startDate><![CDATA[2019-10-07 21:00]]></startDate>
             <endDate><![CDATA[2019-10-07 22:00]]></endDate>
             <category><![CDATA[culture]]></category>
             <tags/>
             <summary><![CDATA[Summary text]]></summary>
             <thumb></thumb>
             <createDate><![CDATA[2019-10-03 16:32:35]]></createDate>
             <owner><![CDATA[Account]]></owner>
             <user><![CDATA[User]]></user>
             <id><![CDATA[524d9c2321678c6d3a10df18]]></id>
       </event>
       <event>...</event>
</events>

Code Example

In PHP using curl to make the request:

<?php
try{
      $url = 'https://api.field59.com/v2/search?type=video&terms=fire';
      $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@59941c23 = curl_getinfo($ch);
      print_r($content);
      print_r(com.dotmarketing.util.ServletResponseCharacterEncoding@59941c23);
} catch (Exception $e) {
    var_dump($e);
}
Share This