I have a problem getting the article text from the news API from The Guardian. I have a URL which is something like this: http://content.guardianapis.com/search?section=technology&api-key=MYKEY and I get a response that looks like this:
{
"response": {
"status": "ok",
"userTier": "developer",
"total": 54530,
"startIndex": 1,
"pageSize": 10,
"currentPage": 1,
"pages": 5453,
"orderBy": "newest",
"results": [{
"type": "article",
"sectionId": "technology",
"webTitle": "Net neutrality has its day in court – with lawyers, Christians and the Cheshire Cat",
"webPublicationDate": "2015-12-05T12:30:06Z",
"id": "technology/2015/dec/05/net-neutrality-has-its-day-in-court-with-lawyers-christians-and-the-cheshire-cat",
"webUrl": "http://www.theguardian.com/technology/2015/dec/05/net-neutrality-has-its-day-in-court-with-lawyers-christians-and-the-cheshire-cat",
"apiUrl": "http://content.guardianapis.com/technology/2015/dec/05/net-neutrality-has-its-day-in-court-with-lawyers-christians-and-the-cheshire-cat",
"sectionName": "Technology"
}, {
"type": "article",
"sectionId": "technology",
"webTitle": "Five things we love: from a school-proof tablet to a ghostly Serbian bicycle",
"webPublicationDate": "2015-12-05T10:00:02Z",
"id": "technology/2015/dec/05/five-things-we-love",
"webUrl": "http://www.theguardian.com/technology/2015/dec/05/five-things-we-love",
"apiUrl": "http://content.guardianapis.com/technology/2015/dec/05/five-things-we-love",
"sectionName": "Technology"
}, {
"type": "article",
"sectionId": "technology",
"webTitle": "Don’t listen to those who try to own the definition of a video game",
"webPublicationDate": "2015-12-04T12:00:21Z",
"id": "technology/2015/dec/04/video-games-gaming-dudegamers",
"webUrl": "http://www.theguardian.com/technology/2015/dec/04/video-games-gaming-dudegamers",
"apiUrl": "http://content.guardianapis.com/technology/2015/dec/04/video-games-gaming-dudegamers",
"sectionName": "Technology"
}]
}
}
and that doesn't include the article text, only a URL to the news page. My question is how do I get the article text?
use show-fields
key and bodyText
key value to your URL then you will get content.
e.g: show-fields=BodyText
http://content.guardianapis.com/search?order-by=newest&show-fields=bodyText&q=politics&api-key=test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With