DayPI Documentation

The DayPI provides programmers with a web accessible interface to Daylife’s news aggregation and analysis service. By using the DayPI, developers can ask rich questions about the news, and retrieve data that will allow them to build applications around the answers to those questions.

This documentation covers DayPI version 4.6.

As a user of Daylife’s API, you have the opportunity to influence near term development of the DayPI. If you have thoughts, complaints, suggestions, comments, or just want to talk, you can leave feedback in the comments attached to each page of the documentation, or send your thoughts directly to us:

Unless you have a separate agreement with Daylife, Inc., your use of the DayPI is covered by our Terms of Use at http://developer.daylife.com/API_TOU. If you’re interested in a commercial agreement, call John Donovan, or send email to partners@daylife.com

About this documentation

The documentation is in several parts:

  1. Basic Concepts discusses conventions that are applicable across the DayPI
  2. Core Reference details the methods available in the DayPI, the mechanics of calling those methods, and the data those methods return.
  3. Appendices give greater detail on the DayPI, discussing search syntax, scores, error codes, and the like.

Basic Concepts in the DayPI

News Objects

The DayPI exposes metadata about and connections around a core set of News Objects. These News Objects and their relationships enable developers to build applications that reveal new kinds of information to users and enable users to explore the landscape of news.

Our goal is to enable developers to ask rich questions about news content, and to build applications around those questions and their answers.

The DayPI allows you to access various methods that retrieve information about the following classes of News Objects:

Articles
Each text-based item made available by a source that Daylife indexes has a corresponding representation in the DayPI. These include blog posts, news articles, press releases, transcripts,
and so on.

Quotes
Quotations extracted from articles that Daylife indexes are attributed to individuals, associated with topics, and made available via a set of API calls.

What has Angelina Jolie said about Darfur this month?

Topics
Daylife's platform organizes content according to things Daylife knows about in the world: People, Places, Companies, Organizations, and so on.

What were the most relevant articles published about Prince Charles this April?

Searches
The DayPI supports full text search of indexed content, and enables retrieval of the context created by the results of those searches.

Which organizations are most mentioned in recent articles about “Solar Powerâ€Â

Unique IDs

Each instance of an Article, Image, Quote, or Topic News Object has a unique ID. These IDs can be obtained initially through the search method calls. For example, the search method call search_getRelatedArticles returns articles containing a query string each with a unique article_id. These unique IDs can then be used to call article_getRelatedQuotes to obtain additional content about or related to that specific article. This principle of unique IDs applies to all News Objects.

Note: Some calls accept multiple unique IDs. In other cases, alternative mechanisms exist to access News Objects other than unique IDs. See the Constructing Requests section and the individual calls in the reference section for more details.

Timestamps

Timestamps are returned by the DayPI and are provided to the DayPI as parameters to News Object method calls. Timestamps are formatted as epoch values or ISO 8601 strings.

In all cases, Timestamps provided to and returned by the DayPI are expressed in Universal Time (UTC).

Epoch Value Timestamp

Date and time represented by an integer indicating the number of seconds elapsed since Jan 1, 1970.

ISO 8601 Timestamps

A string in the form YYYY-MM-DD hh:mm:ss, where date and time are separated by an empty space:

YYYY - four digit number representing the year.
MM - two digit number representing the month. Values are in the range 01 to 12.
DD - two digit number representing the day. Values are in the range 01 to 31.
hh - two digit number representing the hour in 'military time'. Values are in the range 00 to 23.
mm -two digit number representing the minute. Values are in the range 00 to 59.
ss - two digit number representing the whole seconds. Values are in the range 00 to 59.

 

Timestamps in DayPI Requests

The DayPI accepts two request parameters that are timestamps -- start_time and end_time.

start_time always chronologically precedes the end_time. For example, if start_time is "2007-01-01", then end_time must be sometime chronologically after Jan 1, 2007.

Each parameter can accept either an integer epoch value or an ISO 8601 formatted string (see earlier discussion on Timestamps).

Omitted parts of ISO 8601 formatted timestamps fall back to default values with the following rules:

  1. Omitted parts of start_time default to their minimum values. For example:
    • 2004-03 defaults to 2004-03-01 00:00:00
    • 2004-03-05 23 defaults to 2004-03-05 23:00:00
    • If start_time is omitted entirely, it is defaulted to (end_time - 1 month)
  2. Omitted parts of end_time default to their maximum values. For example:
    • 2004-03 defaults to 2004-03-31 23:59:59
    • 2004-03-05 23 defaults to 2004-03-05 23:59:59
    • If end_time is omitted entirely, it is defaulted to the current time (now).

Timestamps in DayPI Responses

Timestamps in DayPI responses are returned as two separate (but logically identical) response parameters for convenience:

 

Constructing Requests


The DayPI is accessed by calling News Object methods and passing parameters via HTTP GET.

Requests are composed by constructing a URL that specifies an API endpoint and a list of input parameters. Input parameters are provided as URLEncoded name value pairs.

A DayPI endpoint is specified like this:

Input parameters are appended to the DayPI endpoint as '&' separated list of name-value pairs of arguments, added to the query string using the standard HTTP GET formatting.

So a fully expressed call to the DayPI looks like this:

For example, a call to search for articles containing the text "iraq war" is defined as follows:

http://freeapi.daylife.com/xmlrest/publicapi/4.3/search_getRelatedArticles?accesskey=<accesskey>&signature=<signature>&query=iraq+war

where <accesskey> is your assigned access key, and <signature> is replaced by an actual MD5 security signature as explained below.

The above request may return multiple articles in its response each with a unique ID (discussed earlier). A request for quotes related to one of these articles would look like this:

http://freeapi.daylife.com/xmlrest/publicapi/4.2/article_getRelatedQuotes?accesskey=<accesskey>&signature=<signature>&article_id=04rJ6WI8rR1nm

If quotes from multiple articles are desired, multiple articles may be provided as multiple article_id parameter name-value pairs as follows:

http://freeapi.daylife.com/xmlrest/publicapi/4.3/article_getRelatedQuotes?accesskey=<accesskey>&signature=<signature>&article_id=04rJ6WI8rR1nm&article_id=06093n03uW2Ku

 

Authentication and Signature Creation

DayAPI users are provided with two authentication credentials to call DayPI methods:

Each DayPI call has a core input at its heart (see earlier discussion on Unique IDs). The specific nature of this core input depends on the News Object being accessed.

In order to authenticate, DayPI users create a signature using the access key, the shared secret, and the core input for the call at hand. That signature string is then used in the API call parameter named signature. The signature parameter is calculated as follows:

So, for example in PHP:

Note that the core input should NOT be urlencoded for the purposes of signature generation. 

If an API call accepts multiple values for the core input parameter (e.g. article calls can accept multiple article ids or multiple article urls), the $coreinput for signature generation is a concatenated string of alphabetically sorted list of the core input values.

For e.g., If I am calling article_getInfo for article ids 0eQ1fovglo368, 0fP60GB2Qy9EX and 08Dh1Ij97064e, to create signature in PHP:

 

 Some more discussion about creating signatures here.

 

Data formats returned by the DayPI

The DayPI returns data in a variety of formats, depending on the value of <protocol> you specify in your constructed request. In this version of the DayPI, there are 3 response formats are available:

Again, the only thing you need to change is the protocol you specify in your method call. So, for instance:


Each returns the same data, only in different formats.

 

Source Filtering

Daylife tracks news from thousands of sources across the world. Sources include mainstream news such as the New York Times, blogs such as BuzzMachine, and other types of news content sources such as Getty Images for photos.

For your application, however, you may wish to restrict the results you retrieve to suppress certain sources, or to only feature content from specific sources.

DayPI users can restrict the results of the DayPIs to sources of their choice by creating and accessing source filters – i.e., whitelists or blacklists of news and image sources. When a source_filter_id (see below) is passed as a parameter to a DayPI call, then the content returned is limited by those sources enumerated in the source filter's whitelist or blacklist.

Every source filter is identified by a source_filter_id. You can have as many source filters as you like, which you can use for various purposes. For example:

In this version of the DayPI, source filters are created and maintained by Daylife. Contact us at developer@daylife.com if you'd like us to set up source filters for you.

 

URL Encoding

Encoding DayPI Requests

All DayPI requests must be made with URL encoded parameter values.

For example query="George Bush" must be encoded as query=%22George%20Bush%22 (or query=%22George+Bush%22).

Wikipedia has a nice overview of URLEncoding (http://en.wikipedia.org/wiki/Percent-encoding).

You can find hard-core documentation in RFC3986 on the IETF site (http://tools.ietf.org/html/rfc3986).

Encoding DayPI Responses

All responses from the DayPI return data in UTF-8 encoding.

You can read more about UTF-8 encoding in a Wikipedia article at http://en.wikipedia.org/wiki/UTF-8 or in the IETF's RFC3629 at http://tools.ietf.org/html/rfc3629

Limit, Offset, and Sort Parameters

The DayPI provides the capability to paginate through and sort returned results.

A DayPI user can page through results by specifying positive integer values for the limit and offset request parameters. For example:

http://freeapi.daylife.com/xmlrest/publicapi/4.3/search_getRelatedArticles?accesskey=<accesskey>&signature=<signature>&query=iraq+war&offset=0&limit=10

DayPI users can also sort results by specifying a sort parameter in the request. For example:

http://freeapi.daylife.com/xmlrest/publicapi/4.3/search_getRelatedArticles?accesskey=<accesskey>&signature=<signature>&query=iraq+war&offset=0&limit=10&sort=date

Most of the DayPI methods allow for sorting by chronologically ascending 'date' or by weighted 'relevance'. For specific information about supported sorting options, refer to the News Object method calls themselves as well as the section/appendix on search query syntax which includes more information on relevance sorting and ways of influencing it.

 

Versioning and Compatibility Levels

In order to accommodate an evolving DayPI while ensuring backwards compatibility (we don't want your stuff breaking!), Daylife uses an explicit versioning scheme.

Each DayPI call endpoint has a version number and every request explicitly specifies the version number in the request URL.

The DayPI uses a Major.Minor.Patch version scheme, like so:

Major

A major change introduces dramatically new and or different functionality, and includes changes in syntax that will almost certainly break existing applications.

Minor/Compatibility Level

The Minor level increments with added features released. A developer should expect to see new features in the DayPI. Minor level changes are NOT guaranteed to be backwards compatible.

Patch Level

The Patch level increments when bug fixing a Minor release. These fixes to existing calls are guaranteed to be backwards compatible for the corresponding Major and Minor level. For example, if a new version 1.4.2 of the DayPI is released, all 1.4 calls will continue to work as before.

Daylife keeps multiple versions of the API running simultaneously, so that your application can continue running against an existing compatibility level until that level is explicitly discontinued.

Usage Restrictions for The Developer Edition of the DayPI

In order to make sure that the broad community of users has access to the DayPI for free, we cap each developer's daily usage of the DayPI.

At this time, you're allowed to make 5000 calls per day to the DayPI.

If your usage will exceed this cap, you should contact us.

Typically, Premium Licenses of the DayPI are not subject to daily usage caps.

DayPI: Search Calls




The Search API methods return search results containing related articles, quotes, images and topics for a given query term.

search_getRelatedArticles

Returns articles that contain the given query term. (See section/appendix on search query syntax.)

Sample Invocation

http://freeapi.daylife.com/xmlrest/publicapi/4.2/search_getRelatedArticles?accesskey=<accesskey>&signature=<signature>&query=Condoleezza+Iraq

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y Iraq war N/A
    end_time Timestamp N 2007-03 <current time>
    start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
    limit The number of results to be returned integer N 40 10
    offset integer N 5 0
    sort string N date, relevance date
    source_filter_id string N 06T8a8lavf8sc None
    include_scores Flag to indicate if enhanced score data be included for every article if available. integer N 0 or 1 0

Sample Output:

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<article>
<timestamp_epoch type="int4">1200682287</timestamp_epoch>
<source>
<name type="str">Associated Press</name>
<url type="str">http://hosted.ap.org/</url>
<daylife_url type="str">http://www.daylife.com/source/Associated_Press</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">0f279rG8jo3Is</source_id>
<type type="int4">1</type>
</source>
<headline type="str">Sunni Sheik Offers Guns and Gets Rewards</headline>
<timestamp type="str">2008-01-18 18:51:27</timestamp>
<related_article_count type="int4">13</related_article_count>
<excerpt type="str">They know him as the sheik. But what that really means in this Sunni town
is a bit of everything: community leader, public works supervisor, agricultural planner,
militia captain.
</excerpt>
<url type="str">http://hosted.ap.org/dynamic/stories/I/IRAQ_SHEIKS_BARGAIN?SITE=TNKNN</url>
<daylife_url type="str">http://www.daylife.com/article/03j9fqr8kkb6B</daylife_url>
<article_id type="str">03j9fqr8kkb6B</article_id>
<scores>
<newsdomain type="str">World</newsdomain>
<op-ed type="int4">5</op-ed>
<spinometer type="int4">-5</spinometer>
</scores>
</article>
........
........
</payload>
</response>

back to top

search_getMatchingTopics

This method is used to retrieve references to Daylife topics whose names match with the given query term. For example, to find the Condoleezza Rice topic, you could use query=Condoleezza.

Sample Invocation

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y Laura+Bush N/A
    limit the number of results to be returned integer N 40 10
    offset integer N 5 0
    include_image Flag that indicates if a thumbnail image for each topic should be returned if available. integer N 0 or 1 0

Sample Output:

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<topic>
<topic_id type="str">0dVm3LAbhJbES</topic_id>
<type type="str">PLACE</type>
<name type="str">United States</name>
<daylife_url type="str">http://www.daylife.com/topic/United_States</daylife_url>
<image>
<url type="str">http://cache.daylife.com/imageserve/0gwb63H2Wmapg/45x45.jpg</url>
<daylife_url type="str">http://cache.daylife.com/imageserve/0gwb63H2Wmapg/340x.jpg</daylife_url>
<thumb_url type="str">http://cache.daylife.com/imageserve/0gwb63H2Wmapg/45x45.jpg</thumb_url>
<timestamp_epoch type="int4">1177281949</timestamp_epoch>
<timestamp type="str">2007-04-22 22:45:49</timestamp>
<credit type="str">AFP/Getty Images</credit>
<image_topic_relevance type="int4">10</image_topic_relevance>
<width type="int4">2860</width>
<height type="int4">2268</height>
<image_id type="str">0gwb63H2Wmapg</image_id>
<caption type="str">
Vania King of the US (L) speaks with US team captain Zena Garrison (R)
during a break in her match against Kirsten Flipken of Belgium in the
quarter-finals round in the Fed Cup World Group 2007 between Belgium and
the US in Delray Beach, Florida 22 April 2007. King won the match 4-6,
6-4, 7-5 to give the US a total score of 3-0 and move to the next round
</caption>
<source>
<name type="str">Getty Images</name>
<url type="str">http://gettyimages.com/</url>
<daylife_url type="str">http://www.daylife.com/source/Getty_Images</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">0a9L9fsaU55wK</source_id>
<type type="int4">6</type>
</source>
</image>
</topic>
........
........
</payload>
</response>


back to top

search_getRelatedTopics

This method is used to retrieve references to Daylife topics that have appeared in articles containing the given query term. To find specifically named topics, use the search_getMatchingTopics method call.

Sample Invocation

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y Iraq N/A
    end_time Timestamp N 2007-03 <current time>
    start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
    limit the number of results to be returned integer N 40 10
    offset integer N 5 0
    sort flag to indicate the sorting order string N date, relevance date
    source_filter_id daylife source filter id string N 06T8a8lavf8sc None
    include_topic_type one or more name value pairs indicating which sorts of topics you wish to include string N person or place or organization person,place,organization
    include_image Flag that indicates if a thumbnail image for each topic should be returned if available. integer N 0 or 1 0

Sample Output

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<topic>
<topic_id type="str">0dVm3LAbhJbES</topic_id>
<type type="str">PLACE</type>
<name type="str">United States</name>
<daylife_url type="str">http://www.daylife.com/topic/United_States</daylife_url>
<image>
<url type="str">http://cache.daylife.com/imageserve/0gwb63H2Wmapg/45x45.jpg</url>
<daylife_url type="str">http://cache.daylife.com/imageserve/0gwb63H2Wmapg/340x.jpg</daylife_url>
<thumb_url type="str">http://cache.daylife.com/imageserve/0gwb63H2Wmapg/45x45.jpg</thumb_url>
<timestamp_epoch type="int4">1177281949</timestamp_epoch>
<timestamp type="str">2007-04-22 22:45:49</timestamp>
<credit type="str">AFP/Getty Images</credit>
<image_topic_relevance type="int4">10</image_topic_relevance>
<width type="int4">2860</width>
<height type="int4">2268</height>
<image_id type="str">0gwb63H2Wmapg</image_id>
<caption type="str">
Vania King of the US (L) speaks with US team captain Zena Garrison (R)
during a break in her match against Kirsten Flipken of Belgium in the
quarter-finals round in the Fed Cup World Group 2007 between Belgium and
the US in Delray Beach, Florida 22 April 2007. King won the match 4-6,
6-4, 7-5 to give the US a total score of 3-0 and move to the next round
</caption>
<source>
<name type="str">Getty Images</name>
<url type="str">http://gettyimages.com/</url>
<daylife_url type="str">http://www.daylife.com/source/Getty_Images</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">0a9L9fsaU55wK</source_id>
<type type="int4">6</type>
</source>
</image>
</topic>
........
........
</payload>
</response>


back to top

search_getRelatedQuotes

This method is used to retrieve quotes from articles that contain the given query term .

Sample Invocation

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y pentagon N/A
    end_time Timestamp N 2007-03 <current time>
    start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
    limit the number of results to be returned integer N 40 10
    offset integer N 5 0
    sort flag to indicate the sorting order string N date, relevance date
    source_filter_id daylife source filter id string N 06T8a8lavf8sc None
    require_speaker flag specifying the quotes returned must be attributed (i.e., the speaker is known) integer N 0 or 1 0
    speaker_topic_id topic_ids of topics that the quotes returned must be attributed to string N name-value pairs of topic_ids None

Sample Output

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<quote>
<quote_id type="str">03TWezQa1M85p</quote_id>
<timestamp_epoch type="int4">1200749352</timestamp_epoch>
<timestamp type="str">2008-01-19 13:29:12</timestamp>
<quote_text type="str">But we will still be friends with the
Americans and invite them to tea every
time they drive through the town
</quote_text>
<source>
<name type="str">MSNBC</name>
<url type="str">http://www.msnbc.msn.com/</url>
<daylife_url type="str">http://www.daylife.com/source/MSNBC</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">07yTb3kbhD6Bo</source_id>
<type type="int4">1</type>
</source>
<daylife_url type="str">http://www.daylife.com/quote/03TWezQa1M85p</daylife_url>
<article>
<timestamp_epoch type="int4">1200749352</timestamp_epoch>
<headline type="str">'Awakening' pacts prove complicated</headline>
<timestamp type="str">2008-01-19 13:29:12</timestamp>
<url type="str">http://www.msnbc.msn.com/id/22739412/</url>
<daylife_url type="str">http://www.daylife.com/article/0baOdqcflg2hB</daylife_url>
<article_id type="str">0baOdqcflg2hB</article_id>
</article>
</quote>
........
........
</payload>
</response>

back to top

search_getQuotesAbout

This method is used to retrieve quotes that mention a given query term .

Sample Invocation

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y pentagon N/A
    end_time Timestamp N 2007-03 <current time>
    start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
    limit the number of results to be returned integer N 40 10
    offset integer N 5 0
    sort flag to indicate the sorting order string N date, relevance date
    source_filter_id daylife source filter id string N 06T8a8lavf8sc None
    require_speaker flag specifying the quotes returned must be attributed (i.e., the speaker is known) integer N 0 or 1 0
    speaker_topic_id topic_ids of topics that the quotes returned must be attributed to string N name-value pairs of topic_ids None

Sample Output

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<quote>
<quote_id type="str">03TWezQa1M85p</quote_id>
<timestamp_epoch type="int4">1200749352</timestamp_epoch>
<timestamp type="str">2008-01-19 13:29:12</timestamp>
<quote_text type="str">But we will still be friends with Condoleezza
and invite them to tea every time they drive through the town
</quote_text>
<source>
<name type="str">MSNBC</name>
<url type="str">http://www.msnbc.msn.com/</url>
<daylife_url type="str">http://www.daylife.com/source/MSNBC</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">07yTb3kbhD6Bo</source_id>
<type type="int4">1</type>
</source>
<daylife_url type="str">http://www.daylife.com/quote/03TWezQa1M85p</daylife_url>
<article>
<timestamp_epoch type="int4">1200749352</timestamp_epoch>
<headline type="str">'Awakening' pacts prove complicated</headline>
<timestamp type="str">2008-01-19 13:29:12</timestamp>
<url type="str">http://www.msnbc.msn.com/id/22739412/</url>
<daylife_url type="str">http://www.daylife.com/article/0baOdqcflg2hB</daylife_url>
<article_id type="str">0baOdqcflg2hB</article_id>
</article>
</quote>
........
........
</payload>
</response>

back to top

search_getRelatedImages

This method is used to retrieve images related to articles that contain the given query term


This API returns any results only when a source filter for image sources is supplied due to image licensing restrictions. Please email developer@daylife.com for more information on image licensing.

Sample Invocation

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y bush N/A
    end_time Timestamp N 2007-09-24 00:00:00 <current time>
    start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
    limit the number of results to be returned integer N 40 10
    offset integer N 5 0
    sort flag to indicate the sorting order string N date, relevance Date
    source_filter_id daylife source filter id string N 06T8a8lavf8sc None

Sample Output

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<image>
<url type="str">http://cache.daylife.com/imageserve/0dDR845cPSa7m/610x.jpg</url>
<daylife_url type="str">http://cache.daylife.com/imageserve/0dDR845cPSa7m/340x.jpg</daylife_url>
<thumb_url type="str">http://cache.daylife.com/imageserve/0dDR845cPSa7m/45x45.jpg</thumb_url>
<timestamp_epoch type="int4">1200582120</timestamp_epoch>
<timestamp type="str">2008-01-17 15:02:00</timestamp>
<image_id type="str">0dDR845cPSa7m</image_id>
<image_topic_relevance type="int4">10</image_topic_relevance>
<width type="int4">3000</width>
<height type="int4">1915</height>
<caption type="str">
US President George W. Bush (C) meets with the Special Envoy for Sudan,
Richard Williamson (L) and Secretary of State Condoleezza Rice (R), in the Oval
Office at the White House in Washington, DC, 17 January 2008.
</caption>
<credit type="str">AFP/Getty Images</credit>
<source>
<name type="str">Getty Images</name>
<url type="str">http://gettyimages.com/</url>
<daylife_url type="str">http://www.daylife.com/source/Getty_Images</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">0a9L9fsaU55wK</source_id>
<type type="int4">6</type>
</source>
</image>
....
....
</payload>
</response>

back to top

search_getCounts

This method is used to retrieve number of mentions in news for the given query

Sample Invocation

Input Parameters

    Name Description Type Required Sample Values Default Value
    accesskey string Y <your_access_key> N/A
    signature string Y <calculated_signature> N/A
    query the search term string Y Laura+Bush N/A
    end_time Timestamp N 2007-03 <current time>
    start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
    source_filter_id string N 06T8a8lavf8sc None N/A

Sample Output:

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<count type="int4">1232</count>
</payload>
</response>

back to top




DayPI: Topic Calls



The topic API method calls return articles, quotes, images and topics for a given topic name or topic id.

Note: Topic data can be queried by either specifying a topic name as the "name" parameter or a topic id as the "topic_id" parameter. One of these must be set.


topic_getRelatedStories

This method is used to retrieve recent articles that contain the given topic specified by name or topic id.

Sample Invocation

Input Parameters

Name Description Type Required Sample Values Default Value
accesskey string Y <your_access_key> N/A
signature string Y <calculated_signature> N/A
name The topic name string Y else topic_id George W. Bush N/A
topic_id The topic id string Y else name 03cV5zI2fk03s N/A
end_time Timestamp N 2007-03 <current time>
start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
limit The number of results to be returned integer N 40 10
offset integer N 5 0
sort Flag to indicate the sorting order string N date, relevance date
source_filter_id daylife source filter id string N 06T8a8lavf8sc None
include_image Flag to indicate if one related scraped image be returned if available. integer N 0 or 1 0
include_scores Flag to indicate if enhanced score data be included for every article if available. integer N 0 or 1 0

Sample Output:


<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<story>
<timestamp_epoch type="int4">1200779025</timestamp_epoch>
<headline type="str">Swiss police temporarily arrest 200 protesters</headline>
<timestamp type="str">2008-01-19 21:43:45</timestamp>
<related_article_count type="int4">6</related_article_count>
<url type="str">
http://rssfeeds.usatoday.com/~r/UsatodaycomWorld-TopStories/~3/219570266...
</url>
<daylife_url type="str">http://www.daylife.com/article/09MLfkP8jnaob</daylife_url>
<topic_story_relevance type="int4">6</topic_story_relevance>
<article_id type="str">09MLfkP8jnaob</article_id>
<excerpt type="str">
...will gather for the annual meeting starting Jan. 23 in the Alpine resort of Davos,
eastern Switzerland. U.S. Secretary of State Condoleezza Rice and British Prime Minister
Gordon Brown will be headliners for the five-day meeting, where a wide range of topics...
</excerpt>
<source>
<name type="str">USA Today</name>
<url type="str">http://www.usatoday.com/</url>
<daylife_url type="str">http://www.daylife.com/source/USA_Today</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">0083e6H4MndJP</source_id>
<type type="int4">1</type>
</source>
<scores>
<newsdomain type="str">World</newsdomain>
<op-ed type="int4">5</op-ed>
<spinometer type="int4">-5</spinometer>
</scores>
</story>
....
....
</payload>
</response>

back to top

topic_getRelatedImages

This method is used to retrieve images related to the given topic.


This API returns any results only when a source filter for image sources is supplied due to image licensing restrictions. Please email developer@daylife.com for more information on image licensing.

Sample Invocation

Input Parameters

Name Description Type Required Sample Values Default Value
accesskey string Y <your_access_key> N/A
signature string Y <calculated_signature> N/A
name The topic name string Y else topic_id George W. Bush N/A
topic_id The topic id string Y else name 03cV5zI2fk03s N/A
end_time Timestamp N 2007-03 <current time>
start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
limit The number of results to be returned integer N 40 10
offset integer N 5 0
sort Flag to indicate the sorting order string N date, relevance date
source_filter_id daylife source filter id string N 06T8a8lavf8sc None


Sample Output:

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<image>
<url type="str">http://cache.daylife.com/imageserve/0dDR845cPSa7m/610x.jpg</url>
<daylife_url type="str">http://cache.daylife.com/imageserve/0dDR845cPSa7m/340x.jpg</daylife_url>
<thumb_url type="str">http://cache.daylife.com/imageserve/0dDR845cPSa7m/45x45.jpg</thumb_url>
<timestamp_epoch type="int4">1200582120</timestamp_epoch>
<timestamp type="str">2008-01-17 15:02:00</timestamp>
<image_id type="str">0dDR845cPSa7m</image_id>
<image_topic_relevance type="int4">10</image_topic_relevance>
<width type="int4">3000</width>
<height type="int4">1915</height>
<caption type="str">
US President George W. Bush (C) meets with the Special Envoy for Sudan,
Richard Williamson (L) and Secretary of State Condoleezza Rice (R), in the Oval
Office at the White House in Washington, DC, 17 January 2008.
</caption>
<credit type="str">AFP/Getty Images</credit>
<source>
<name type="str">Getty Images</name>
<url type="str">http://gettyimages.com/</url>
<daylife_url type="str">http://www.daylife.com/source/Getty_Images</daylife_url>
<rank type="int4">1</rank>
<source_id type="str">0a9L9fsaU55wK</source_id>
<type type="int4">6</type>
</source>
</image>
....
....
</payload>
</response>

back to top


topic_getRelatedTopics

This method retrieves topics that appear in the same articles as the given topic specified by name or topic id.

Sample Invocation

Input Parameters

Name Description Type Required Sample Values Default Value
accesskey string Y <your_access_key> N/A
signature string Y <calculated_signature> N/A
name The topic name string Y else topic_id George W. Bush N/A
topic_id The topic id string Y else name 03cV5zI2fk03s N/A
end_time Timestamp N 2007-03 <current time>
start_time Timestamp N 2007-05-03 09:00:00, 1178182800 <end_time minus 1 month>
limit The number of results to be returned integer N 40 10
offset integer N 5 0
sort Flag to indicate the sorting order string N date, relevance date
source_filter_id daylife source filter id string N 06T8a8lavf8sc None
include_topic_type A comma separated list of types of topics that should be returned string N person or place or organization or a comma separated list of any of their combinations person,place,organization
include_image Flag that indicates if a thumbnail image for each topic should be returned if available. integer N 0 or 1 0


Sample Output:

<response>
<message type="str">Success</message>
<code type="int4">2001</code>
<payload>
<topic>
<topic_id type="str">0dVm3LAbhJbES</topic_id>
<type type="str">PLACE<