I was having issues trying to use Ximilar making an image recognition app. I had followed a tutorial
and read a previous post with a similar issue. However, I am getting a different form of error. When I take a photo, the API is called, yet it sets the label to null, which I do not understand. I am including a photo of the code as a reference
Hi joshuatom20097wtkq0, welcome to Thunkable!
Be sure to check out How to ask Great Questions v2.0, the Community Guidelines, and our Getting Started Guide to make the best of your Thunkable Community experience!
Could you drag another green error block to set label 15’s text to that green error block. It’ll look like this:
Thank you. I did that, and the label still results in a “null” message
Thanks for checking on that! Since we can rule out an error connecting to the API, the issue will be with how the data is being pulled.
Have you been able to check this call in Postman to see if it works there as you have it set up? My familiarity with Ximilar is none but the likely place where this has gone wrong is in the nested value records[1].best_label.name
Is that the correct property? When the value returned is null that means there is a lack of any value and so I would check the JSON to see if this is correct.
There is a great topic on how to parse JSON here: API JSON Tutorial (Video)
Thank you, sorry for getting back to you a little late. I will check on that and see if that fixes anything.
I rearranged the order of the nested values the way the video depicted, yet I’m still getting the same error. I am definite that these are the correct properties.
Could you set the label to just the response? If the response is an object, please turn it into a JSON first. This way we can see what the entire return gives us.
when I set the label to just response, the app turns the label into a url, when i put labels response as get object from JSON, thats when the label turns into a null
From what you shared, it looks like we are not getting the response you are expecting. The response contains a URL which is why it doesn’t work when you turn it into an object. I would look into the API call to ensure it is correct.
ok thank you. When i turned the image into a url and plugged it into the API, the photo is correctly sorted. So I’m pretty sure that the API just isn’t being called correctly. Do you also recommend that I turn the photo into that hexcode option instead of using the url
It would depend on the documentation and requirements of the API call. Most API calls would like either the file or the hexcode. I would refer to the docs of that API.