Re: [guardian-api-talk] A few content API questions

164 views
Skip to first unread message

Michael Brunton-Spall

unread,
Apr 4, 2013, 3:36:21 PM4/4/13
to Guardian API Talk
Hey Mike,

Sorry for the delay, I'm away on holiday this week, so I've been lagging at keeping up on the mailing list.

Here are some quick answers, feel free to email back with any questions and I'll try to get back to you early next week.

1). You should be able to use editorsPicks, but not from the search endpoint.  See question 2 for more details.

2). No, to get a list of articles for a section or tag, you should go to the item endpoint for the tag or section in question.  These are always url compatible with the guardian site, so for the uk section, you should be able to go to http://content.guardianapis.com/uk?format=json&show-editors-picks=true and you should get back an editorsPicks list as well as a results list.
You'll mostly notice that m.guardian.co.uk shows the editors picks first, then the most recent content after.
show-most-viewed=true should give you a list of the most-viewed content for that section.

3) Without a key, you can use show-fields to request the trailtext or standfirst.  They are often similar, single paragraph representations of the content. (The trail text "trails" a piece of content on a navigation page, the stand first stands before the content on the same page).
With a key you'll be able to request the whole body itself, but it will contain an advert and tracking pixel link that you'll need to display to use it.

I hope that helps

Michael Brunton-Spall

Michael Brunton-Spall
guardian.co.uk


On 4 April 2013 14:25, Mike Roberts <mike.b....@gmail.com> wrote:
Apologies if this comes through twice, I don't think it worked the first time...

--

Hi Michael and other friendly Guardian people, I have a few questions on using the API.


To give context I'm writing a small application that will email me on a daily basis the list of the 'current top 5' stories with a headline and/or summary, with a link to the full item, from various sections that I choose. The NY Times has this service and I find it a great way of keeping abreast of the world. I've had a quick explore and written some code, but I'd like to ask a few things:

1) Is there a way of getting a list of results ordered by something other than newness? Editorial would be best, but I'd take popular if necessary. What I really want is the list of results to come back in the same order as they appear on the web or mobile pages. For example if I go to http://m.guardian.co.uk/uk I see a different list of results than if I go to http://explorer.content.guardianapis.com/#/search?tag=uk&format=json


I did try using 'Editors Picks' for this, but this seems to give a completely different set of results, and doesn't return anything for some sections, so I'm guessing this is not what I want to use 


2) What's the correct way to get a list of articles from a subsection? E.g. if I want cricket stories should I just do 'sport/cricket' as a tag search?


3) I don't have an API key yet but when I do will I have access to the summary paragraph that appears on the site? If not is there any other way of getting this that I've missed so far?


Cheers


Mike

--
You received this message because you are subscribed to the Google Groups "Guardian API Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To post to this group, send an email to guardian...@googlegroups.com.
Visit this group at http://groups.google.com/group/guardian-api-talk?hl=en-GB.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mike Roberts

unread,
Apr 4, 2013, 8:01:50 PM4/4/13
to guardian...@googlegroups.com
Hi Michael,

Good to hear they still allow holiday back in my homeland - I was worried that may have all gone away thanks to the government's austerity measures! ;)

Thanks for that - I've got that all working now and no API key necessary! Cricket still seems a bit weird for me (I'm only getting 'Watch England cricket highlights') but I'll dig into that.

If anyone is interested the source is at https://github.com/mikebroberts/guardian-digester . The only bit I have left to do is the email part but the app will run and show results via a web server at the moment. The source as it is will run in Heroku.

Also I was going to write a general purpose clojure sdk for the Content API off the back of this but since it required all but 1 line of code [1] I don't think it's really worth it!

Cheers again,

Mike

[1] (:body (clj-http.client/get <url> {:as :json}))
Reply all
Reply to author
Forward
0 new messages