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.
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.
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 !
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.
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.
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” ?
Good question. You’re right, you don’t need an API to get data from most of the API endpoints.
The API key is only required to save data to the API, so that data stays with your Account - e.g. Votes, Favourites, Uploaded images etc.
You can then retrieve that data via the API using that same API key. Once i get time to turn on Analytics, you’ll be able to get your request counts using the key too.
Hello. I’ve ran into an issue today that I just can’t seem to fix by my own:
I am writing a python script that downloads pictures from this API.
It sends a GET request to https://api.thecatapi.com/v1/images/search, it then grabs the image URL, and tries to download it using wget.
The problem is that when I try to download it (via wget or urllib.requests), I always get HTTP Error 403: Forbidden, and the image isn’t downloaded.
I saw that someone was having the same issue here on this post, and they fixed it by adding a user agent, but it just doesn’t seem to work for me, no matter what user-agent i try to use.
Do you have any idea what could be causing this, or a pointer as to what I could do to possibly fix the issue?
Hello, I try write mobile app for on android. But if I send request I get in serponse ““message”:“Cannot read property ‘name’ of undefined”,“status”:500,“level”:“info”” what it does mean. I’m don’t understant. What I do not this way. Because in postman all queries work correctly. Help me please
If you need code snipens for example i will send them. :’(
@rvyZ Please start a new thread, instead of hijacking this one. Include as many code samples as possible, and ensure your question pertains to the Cat API or the Dog API
Can’t upload dog image through upload tab on https://www.thedogapi.com/ - for some reason it’s expecting me to provide cat image (“Upload a .jpg or .png Cat Image”)
/images “order” parameter doesn’t work - even if it’s set to ASC or DESC /images is still returning random set of images. Which basically breaks “page” parameter as well.
For example the following url is providing random set of images every time: https://api.thedogapi.com/v1/images/search?limit=5&order=ASC&page=0