Questions / Feedback / Bugs for the Cat or Dog APIs?

Great Question Stepan.

I’ve added both the ‘vote’ and ‘favourite’ objects that match the (account + ‘image_id’ + ‘sub_id’) key to every response from the ‘/images’ routes.

You can see it in action here: https://thecatapi.com/?id=JdMcWHjhB&sub_id=stepan-test

Just Fav/Un-Fav to see the ‘favourite’ little heart icon on the Image added & removed, and Vote Up/ Vote Down, then refresh the page you’ll see the ‘vote’ thumb icon change.

This will work for the ‘/images’ ‘/images/:image_id’ and ‘/images/search’ routes.

Let me know if you need anything else to support your use-case.

1 Like

Is there any way to search for photos of a particular breed on the dog API?
This seems to be in place for the cat API, but not the dog API…

It would be nice to be able to do /breeds/:breed_id/images, or /search, and get image results of that dog breed.

Great question. There absolutely is, both APIs share the same codebase. I just need to update it to the latest version.

As you suggested you’ll be able to search for Dog images by breed in the same way as the Cats via /images/search?breed_id={breed.id}

Here’s a live example - https://docs.thecatapi.com/example-by-breed

I expect this to be done early next week, once the new /breeds data for theCatApi is complete.

Here’s the Trello ticket to track it. https://trello.com/c/6Rleanhr/90-release-new-codebase-to-thedogapicom

EDIT: Problem solved, original question below.! I just needed to add a user-agent header to my urllib.request. It’s still weird that the dog API doesn’t require this.

Hey Aden,

I’m trying to search for random cat pictures using your cat API with my Discord bot. Or, I have used it for a few months so far without any issues. Just recently I have noticed this weird issue where the API gives a 200 response code with requested data, as it should, but it also gives an 403 forbidden error as well. I used this as the request, found from the official docs: https://api.thecatapi.com/v1/images/search?limit=3&page=100&order=DESC. I also have my API key in the request headers, I even tried requesting a new one and using that but so far no luck.

So, I get a response from the API, but at the same time my request fails with 403 error code. I’m also using your dog API for the same purpose, and it works with pretty much identical code.

EDIT: Also, I’m trying to read the image as bytes for uploading the image directly to Discord. I’m using Python’s urllib.request.urlopen for this. I think this might cause the problem, but I’m using the same solution with the dog API and it’s working there properly.

Do you have any tips what might cause this?

Troikku

Thanks for posting your issue @Troikku . Really interesting issue, haven’t been able to reproduce it yet, however i have a sneaky suspicion based on what you’ve said that it may be Cloudflare related.

I integrated Cloudflare as a new CDN a few days ago and am still working out the kinks. It’s cut the daily Cloudfront/S3 costs from ~$3 to ~$0.50 a day, but thrown complications into the stack which could be responsible for this odd occurrence

I’ll tweak the settings and let it run for another few days, after which I’ll rollback if there’s still any issues.

Thanks for your patience, and please do let me know if you see any other issues.

Hi Aden

I am creating App by thecatapi. Could I get the image size from the entry?

Could you add two properties, width and height in the Cat object?

Hi Aden,

Loving the cat and dog apis! Quick question on whether there is rate limiting for the REST calls.

Great suggestion, I’ve added it to the roadmap and aim to get to it in the next 2 weeks.

Here’s the ticket for updates: https://trello.com/c/IeMsTD8Z/129-add-width-height-of-image-to-response

Great question @chewwwwwwwwww, I try to let people use the API for as many different use-cases as possible. So while there’s no hard limit, there is a soft limit for behaviour flagged as malicious.

There’s plenty of apps using the API that have gone viral and sent massive spikes of traffic, all fine and handled without limits. However if it can’t realistically be attributed to this, of even someone infrequently load testing testing their app, then the rate-limiter could kick in.

For instance behaviour that looks like a DDOS attack, or even more basic patterns like 1000’s of request per second from the same IP without waiting for a response.

If you’re getting erroneously rate-limited (429 or 5XX response code depending on the use-case), then just send me an email with the details and i’ll have a look.

Hi Aden,

I checked that but I’m not getting a “favourite” object inside Image object returned by search, but the picture was already favourited by the user. Could you please check that and by the way update the models in documentation?

1 Like

Hi Aden,

Recently I got hit with the following error

SSL_connect returned=1 errno=0 state=error: certificate verify failed

I realised that I’ve been hitting your APIs without an API key all along! I’ve tried to sign up for a free API but it’s giving me this error.

image

Thanks again for this great API and looking forward to the bug fix!

Thanks for the post @chewwwwwwwwww, looks like there was some issues with the SSL cert auto renewal.

Fixed the DNS issue, just waiting for AWS to renew the cert. Should be in the next hour or so. This will fix both the API and signup issues.

Will ping another update once it’s finished.

New cert for the Dog API (api.thedogapi.com) has been approved, and service is back as normal.

Anything else just let me know.

Best, Aden

Hi Aden,

My team is looking to create an app that would involve image recognition of dog photos, and we were excited to find this api! However, we’re having trouble with the https://api.thedogapi.com/v1/images/upload endpoint through your website.

We’re putting our API key in the header field x-api-key, checking the box next to Send requests directly from the browser (CORS must be enabled) in Settings, and for the body we’re putting:
{
“file”: “https://live.staticflickr.com/65535/47698046842_78ef1be8b7_b.jpg”,
“sub_id”: “EliasBichon”
}

However, upon clicking Send, it works on it for about 30 seconds and finally responds with:
{
“level”: “info”,
“message”: “Cannot read property ‘name’ of undefined”,
“status”: 500
}

What are we doing wrong? I’ve tried the images/search and it seems to be working fine, so I don’t think the server is down. I’ve also tried using Postman and it doesn’t seem to work either.

Interesting question.

The image/upload method expects an actual file, instead of a url to a file hosted elsewhere.

So quickest way is to download the file first, then use the upload method, either manually or building a little proxy script.

It’s a good feature suggestion though, so i’ll look at adding it as a core feature next week!

Best, Aden

n.b - the Postman collection has been updated to clarify the ‘file’ parameter - apologies, it was definitely not clear. - https://documenter.getpostman.com/view/5578104/RWgqUxxh

Thanks Aden for the quick response! I think updating the documentation will certainly help prevent confusion in the future (although I did notice you only updated The Cat API but not The Dog API documentation, neither on Postman nor thedogapi.com website).

Anyway I’ve now got everything working on Postman. Actually before I posted on this forum I did try using Postman to upload a file from my local machine, but I wasn’t able to get it to work. But after you posted the reply I tried troubleshooting again and it turned out the reason it wasn’t working was because I didn’t have TheDogAPI - live set as my environment.

Hello @Aden ,

I’m playing with Dog Api and have been very funny. My Suggestion is include a thumb url on body of Breeds Model, (Maybe the first image related or null ?) so we can have a preview of that breed without make an extra request.

I’m building an app that show the breeds and would be awesome to show the image thumb on a list, like pinterest or something.

Thanks for your project, its very well documented and fun !

Hi @Aden,

First I gotta say, love the api! Thanks!

I’ve implemented a python wrapper for thecatapi (catapi.py if you’re curious), and I have some questions on what a few parameters are for and feedback on the api at the moment.

Questions:
On docs.thecatapi.com/api-reference/breeds/breeds-list , what is the attach_breed parameter for? I couldn’t find anything on it.

What mime_types are available when searching for an image? How are the mime_types used? Do you have an example url that would show how to pass an array in for a parameter? Any attempts I’ve made at using mime_types have failed.

Feedback:
The image analysis data returned from /images/{image_id}/analysis doesn’t seem to match the example response shown. Rather than getting [image, labels, moderation labels, vendor, approved, rejected] attributes back, I get [image, labels, moderation labels, vendor, created at] without any approved/rejected status.

There’s a misspelling on images-search page in the docs, Iterate should only have one t.

Thanks again for the api!

Hi Aden,

When trying to get a specific image i don’t get the vote and favourite.
GET images/<IMG_ID>?image_id=<IMG_ID>&sub_id=<SUB_ID>

Atfer looking at the documentation, it appears that these properties are only returned if i’m the owner of the image, which i guess means that i uploaded it.

“If you are the owner then the full Image response will be present, and any Vote or Favourite matching your account & sub_id will be attached.”

Would it be possible to have these properties on the object event if i’m not the owner, like it’s already done on the route “GET /images/search” ?

Thanks !

Hey, just found your API! It’s cool, but I had a question:

If I have a list like this (attached image), I’d like to have an image of the breed to the left of the name.

Currently, the breed list doesn’t provide an image url.

Would it be possible to add one to the Breed model? Like a “cover photo”. I’d prefer not to make 50+ GET requests for an image for each list item :slight_smile:

Thanks!

34