Get a feed of quotes said by a particular person

By vineet

Problem

How to get a feed of quotes said by a particular person say Barack Obama. Or pull quotes said by Steve Jobs about ipod.

 

 

 

Solution

a. Ensure if the name you have is a topic in our system or not. You can call topic_getInfo to confirm.

For e.g., http://freeapi.daylife.com/xmlrest/publicapi/4.4/topic_getInfo?name=Barack%20Obama&accesskey=8befa1cf0a7c0291613242235638a662&signature=82a0ad71c7180a36530c9f59daea6617

returns you


<response>
<message type="str">Success</message><code type="int4">2002</code>
<payload>
<topic>
<daylife_url type="str">http://www.daylife.com/topic/Barack_Obama</daylife_url>
<type type="str">PERSON</type>
<name type="str">Barack Obama</name>
<topic_id type="str">06lF7Psg5T6IV</topic_id>
</topic>
</payload>
</response>

 b. Once you are sure you have a full topic name, you can call topic_getQuotesBy by providing the topic name in the name parameter or the topic_id returned in step a. in the topic_id parameter.

For e.g., this call returns you quotes spoken by Barack Obama
http://freeapi.daylife.com/xmlrest/publicapi/4.4/topic_getQuotesBy?name=Barack%20Obama&accesskey=8befa1cf0a7c0291613242235638a662&signature=82a0ad71c7180a36530c9f59daea6617

And the response looks like this:
<response>
	<message type="str">Success</message>
	<code type="int4">2001</code>
	<payload>
		<quote>
			<quote_id type="str">01ME0mggh86ql</quote_id>
			<timestamp_epoch type="int4">1204246432</timestamp_epoch>
			<timestamp type="str">2008-02-29 00:53:52</timestamp>
			<daylife_url type="str">http://www.daylife.com/quote/01ME0mggh86ql</daylife_url>
			<quote_text type="str">With respect to our NATO allies, I've been very clear that we do need more support from them. We also may need to lift some of the constraints that they have placed on their forces there</quote_text>
			<name type="str">Barack Obama</name>
			<topic>
				<daylife_url type="str">http://www.daylife.com/topic/Barack_Obama</daylife_url>
				<type type="str">PERSON</type>
				<name type="str">Barack Obama</name>
				<topic_id type="str">06lF7Psg5T6IV</topic_id>
			</topic>
			<source>
				<name type="str">Reuters Alert Net</name>
				<url type="str">http://www.alertnet.org/</url>
				<daylife_url type="str">http://www.daylife.com/source/Reuters_Alert_Net</daylife_url>
				<rank type="int4">1</rank>
				<source_id type="str">0aXzav6bE66DA</source_id>
				<type type="int4">1</type>
			</source>
			<article>
				<timestamp_epoch type="int4">1204246432</timestamp_epoch>
				<headline type="str">Obama says Europe must do more in Afghanistan</headline>
				<timestamp type="str">2008-02-29 00:53:52</timestamp>
				<url type="str">http://www.alertnet.org/thenews/newsdesk/N28618112.htm</url>
				<daylife_url type="str">http://www.daylife.com/article/0e9jfFbeQy1jV</daylife_url>
				<article_id type="str">0e9jfFbeQy1jV</article_id>
			</article>
		</quote>
	............
	............
	............
	</payload>
</response>
	

Alternatives

In case you want to skip step a. in the solution above, you can call search_getQuotesBy. This api call takes your query parameter, retrieves all topics that have a matching name to your query and the returns you quotes said by one or more of these topics.

For e.g., here is a sample URL that returns you quotes said by somone whose name has Clinon:

http://freeapi.daylife.com/xmlrest/publicapi/4.4/search_getQuotesBy?query=clinton&accesskey=8befa1cf0a7c0291613242235638a662&signature=f2a547e445c146439affabf48b0daabb