...
Initially we sign to put everything query parameter in the request body, in order to make the URL string more readable for users, but soon we realize that GET request doesn’t contain request body, therefore we have two options: to put query in query string, or to use POST request for the usage of request body, but to keep request format in standard, we have finally choose the query string as our selection.
API usage
Return all matching reports that match the parameters given
Code Block |
---|
GET/report/?country=''&city=''&start_date=''&end_date=''&key_terms='' |
Parameters:
country - the country to find reports for
city - the city to find reports for
start_date - the starting date and time to search for
end_date - the ending date and time to search for
key_terms - comma-separated list of key terms to search for e.g. disease names, symptoms. Can be left empty if the user wants to get all reports
If a report cannot be extracted, a message saying how many reports could not be extracted is provided, as well as a list of each article url and publish date of the article.
Example: getting all reports that mention “Outbreak” or are about “Hantavirus“ from Canberra, Australia between 2011-04-19T11:48:00 and 2022-03-16T09:38:00
Request
Code Block |
---|
curl -X 'GET' \ 'http://localhost:4000/report?start_date=2011-04-19T11%3A48%3A00&end_date=2022-03-16T09%3A38%3A00&city=Canberra&country=AU&key_terms=Outbreak%2CHantavirus' \ -H 'accept: appplication/json' |
Response
Code Block | ||
---|---|---|
| ||
[
{
"url": "http://www.upi.com/Top_News/World-News/2013/05/15/Salmonella-poisoning-outbreak-in-Australia/UPI-30421368619035/ ",
"headline": "Salmonella poisoning outbreak in Australia",
"main_text": "DICKSON, Australia, May 15 (UPI) -- At least 100 people have been diagnosed with salmonella poisoning after eating at a new restaurant in Australia, health officials said.",
"reports": []
},
{
"url": "https://www.foodsafetynews.com/2021/11/salmonella-top-cause-of-foodborne-outbreaks-in-australia/ ",
"headline": "",
"main_text": "Salmonella dominated reported outbreaks in Australia in 2016 causing several large incidents, according to a study published recently.",
"reports": []
},
{
"url": "https://www.foodsafetynews.com/2021/07/salmonella-dominates-outbreaks-in-australia/ ",
"headline": "",
"main_text": "More than 450 foodborne outbreaks were reported over a three-year period in Australia, according to a new study.",
"reports": []
},
"1 article(s) could not be scraped from: [{\"url\":\"http://www.healthcanal.com/infections/36035-Deadly-virus-discovered-bats-also-jumps-species.html \"}]"
] |
Return a single report that match the data
...