nytimes / public_api_specs

The API Specs (in OpenAPI/Swagger) for the APIs available from developer.nytimes.com
http://developer.nytimes.com
Apache License 2.0
136 stars 40 forks source link

No response/403 for specifically paginated requests #25

Closed nachtm closed 5 years ago

nachtm commented 7 years ago

Hi,

The following request gives no response (I've curl-ed and gone through the python requests library): https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=persons%3A%28%22Obama%2C+Barack%22%29&page=11&api-key=xxxx

The following request gives an html "403 forbidden" response: https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=persons%3A%28%22Trump%2C+Donald+J%22%29&page=12&api-key=xxxx

The following requests give valid, seemingly correct json responses: https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=persons%3A%28%22Trump%2C+Donald+J%22%29&page=11&api-key=xxxx

https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=persons%3A%28%22Trump%2C+Donald+J%22%29&page=13&api-key=xxxx

https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=persons%3A%28%22Obama%2C+Barack%22%29&page=10&api-key=xxxx

https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=persons%3A%28%22Obama%2C+Barack%22%29&page=12&api-key=xxxx

In other words, the 11th page of fq=persons:("Obama, Barack") returns nothing (despite the 10th and 13th returning correct results), and the 12th page of fq=persons:("Trump, Donald J") returns a 403 Forbidden page (despite the 11th and 13th returning correct results).

A friend tried this on his computer with a different api key and got the same results.

Any ideas on what's going on?

nyt-hughmandeville commented 7 years ago

This is a known bug we are working on fixing. A work around is to set the field list in the query parameters to only the fields you want (e.g. fl=web_url).

nachtm commented 7 years ago

Thanks! I think that worked for me.

nyt-hughmandeville commented 7 years ago

The 403 bug should be fixed now.

nachtm commented 7 years ago

Yep, I can confirm that it's working for me. Thank you!