This is a Rails 5 API meant for use with a IOS Swift App CatchUp. Ruby Version 2.3.0
Currently using Guardian API to gather articles. You will need to get an API Developer Key in order to use this site.
git clone git@github.com:DStorck/backend-news-API.git
cd backend-news-API
bundle install
- get Guardian API key and put in .env as GUARDIAN_API_KEY
parameter | data type | description |
---|---|---|
keyword |
string | Search by keyword |
page |
integer | (Optional) page of data returned. First response is page 1 by default. |
parameter | data type | description |
---|---|---|
topic |
string | Section of newspaper to search. Endpoints can be found on Guardian API website. |
page |
integer | (Optional) page of data returned. First response is page 1 by default. |
###Example Request and Reponse
Request URL:
GET:
/soccer
Response data:
[
{
"id": 2412,
"title": "Seattle and USA striker Clint Dempsey sidelined with irregular heartbeat",
"url": "https://www.theguardian.com/football/2016/aug/26/clint-dempsey-seattle-usa-sidelined-world-cup-mls-irregular-heartbeat",
"created_at": "2016-08-26T22:03:01.454Z",
"updated_at": "2016-08-26T22:03:01.454Z",
"guardian_id": "football/2016/aug/26/clint-dempsey-seattle-usa-sidelined-world-cup-mls-irregular-heartbeat"
},
{
"id": 2413,
"title": "A strict diet of pie in the sky",
"url": "https://www.theguardian.com/football/2016/aug/26/a-strict-diet-of-pie-in-the-sky",
"created_at": "2016-08-26T22:03:01.458Z",
"updated_at": "2016-08-26T22:03:01.458Z",
"guardian_id": "football/2016/aug/26/a-strict-diet-of-pie-in-the-sky"
},
{
"id": 2414,
"title": "Hope Solo's punishment shows that women are judged more harshly | Shireen Ahmed",
"url": "https://www.theguardian.com/football/2016/aug/26/hope-solo-suspension-female-athletes-double-standards",
"created_at": "2016-08-26T22:03:01.461Z",
"updated_at": "2016-08-26T22:03:01.461Z",
"guardian_id": "football/2016/aug/26/hope-solo-suspension-female-athletes-double-standards"
}
]
Run all tests with rake test