HI there, thanks so much for making the Cats Api. I have a problem with the API not returning pagination headers.
My code first calls
https://api.thecatapi.com/v1/breeds. I pass the API key that I obtained from you and no query params. The API call returns the 3 pagination headers successfully.
Next, again using my own API key, the code calls
https://api.thecatapi.com/v1/images/search limit=8&page=0&order=DESC&. No pagination headers are returned. I don’t understand why this is the case, because it looks like the API request is correctly formed.
If I change my code to use DEMO-API-KEY in place of my API key, then the /images/search call works as expected, returning the 3 pagination headers.
What am I missing here? Thanks in advance.
You should be able to see the pagination headers in the response, as shown in the example with the chrome inspector open
Good find on the lack of PAgination headers when authenticating via an api_key - it looks like the Pagination headers are only returned if the api_key / x-api-key is valid. If it is not then no pagination headers are returned
Thanks for your response. I generated a new API key and now I do get Pagination headers.
It looks like I dropped a digit from my original API key when copying it from the email. So that’s why I wasn’t getting the headers.
I would expect the server to give me some kind of error with an invalid key rather than silently (mostly) working. Do you agree?
I completely agree. The API will throw an error if you try to write any data to your account with an Invalid key, or GET ./images, ./facts ./jokes ./votes or ./favourites - however with the GET
./images/search endpoint it does not
I’ll add it to the list for the next release - thanks for the feedback, it’s always appreciated