If I go to the following location:
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=51.5112139,-0.1198244&types=lodging&radius=3200&sensor=false&key=yourKey
I get the error:
{
"debug_info" : [],
"html_attributions" : [],
"results" : [],
"status" : "UNKNOWN_ERROR"
}
Is there any reason for this?
When I lookup Bristol(51.454513,-2.58791), Ipswitch(52.056736,1.14822) or Edinburgh(55.953252,-3.188267) I get a normal JSON file back full of data.
I don't know how Google works internally.
Unknown error simply means to me that "We have an error with your request, and we don't want you to know what the exact error is". Most of time, it is from the internal exception handling process.
Honestly, I don't know what happens in Google.
However, if you change your radius from 3500 meter to 2000 meter, it works fine
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=51.5112139,-0.11982439999997041&types=lodging&radius=2100&sensor=false&key=key
My guess is there are too many results, and Google cannot handle that much.
I don't know why but the URL works sometimes, and sometimes doesn't work.
The "UNKNOWN_ERROR" status may be internal error of Google.
To prevent the error temporally, shorten the radius.
And report this to the gmaps-issues-tracker.
https://code.google.com/p/gmaps-api-issues/
Rank by distance seems to have some issues with radius. Is this implied in your situation?
Google
Stack Overflow
Related
I am trying to get the proper output from the API but each time it throws an error, and not having enough information about the error makes it more default here is the below example and same happened with other files too
{
"Usage": "0.47476506233215",
"Resource": "/photoscene/XkQN53pc1WCI66ExM6DnjVmKCYb6ZyRZ8ntmwdTjj8U/progress",
"Photoscene":
{
"photosceneid": "XkQN53pc1WCI66ExM6DnjVmKCYb6ZyRZ8ntmwdTjj8U",
"progressmsg": "ERROR",
"progress": "100"
}
}
What are the guidelines for the input images?
Do we have any sample input images for POC?
Thanks in advance!!
From what I've seen, these errors are often caused by insufficient input data. For example, check out this Stack Overflow question: Error: Processing is failing in Autodesk-Forge when converting the image to 3D.
Consider providing more information about your particular case - how many images have you used to reconstruct the scene, what resolution/quality were they?
What format should I return the response to the API user if an error occurred? Just return the response as a status code and error message:
Full authentication is required to access this resource
(the status 401 was returned)
Or it is better to return it in this format:
{
"timestamp": "2020-06-14T21:20:52.941+0000",
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource",
"path": "/api/users/me"
}
Well, it depends:
If you know your front end urgently requires the direct message of the error, ignoring anything else, then going for the short and direct to the point answer might be your best choice.
But honestly, if experience in programming has taught me anything, is that the more information you have about something, the better, ESPECIALLY IF IT'S an ERROR!!! With the longer response, you have many more tools in you hand, both for giving the final user a better look of your application - You can present for the user a small title, a detailed message and, for example, use an internal code to show a red "error" box if a fatal error ocurred or a "warning" yellow box if a validation simply failed - and especially for the dev to solve that problem (The final user might never see the "timestamp", "status", "path" or stacktrace of the error - He shouldn't... - But it will surely help you track what caused the error).
Take a look at these (1, 2 and 3) articles to help you decide your situation and, if needed, customize your error response structure
According to the reference
Limit: Limits the number of entities to be returned. Maximum is 500. Default is 20. Requests with high limits have a higher chance of timing out.
but I'm facing a weird behaviour, if I try to query for example https://www.nasa.gov/ and without setting a limit (which defaults to 20) I get a response of:
{
"error": {
"code": 429,
"message": "Over resource limits. Try a more restrictive request.",
"status": "RESOURCE_EXHAUSTED"
}
}
Now if I try with a limit of 19 or 21 I don't get any error at all.
I do realise that the error says "RESOURCE_EXHAUSTED" but it doesn't seem to be the problem here.
Note: using limit of 10 or 15 also gives the same error
This is a url to test
https://developers.google.com/knowledge-graph/reference/rest/v1/?apix_params=%7B%22query%22%3A%22https%3A%2F%2Fwww.nasa.gov%2F%22%7D
As the Google Knowledge Graph Search API notes:
Warning: This API is not suitable for use as a production-critical service. Your product should not form a critical dependence on this API.
I assume the API is not suitable for production-critical services due to errors like these. I unfortunately do not know why the error occurs, but in order to avoid your program from crashing and mitigate the effects of the error, I suggest you place your query in a try-catch block. So in Python:
import googleapiclient.discovery
try:
service = googleapiclient.discovery.build('kgsearch', 'v1', developerKey=YOUR_API_KEY)
search = service.entities().search(languages="en", limit=20, prefix=True, query="nasa")
search_result = search.execute()
except:
print("error while querying kgsearch")
Note: the error does not occur anymore (as you pointed out in the comments), however this is still a relevant issue as my program tried querying "data" and resulted in the exact same error as you described. I know the provided solution does not directly answer your question, but it was my work around it.
According to the documentation requesting a map from Google (via the Static Map API) when you have exceeded the usage limit displays an 'error' image. This is okay I guess but what I really want to do is detect the error so I can log something meaningful and alert the team.
Does anybody know if anything is returned in the RequestHeader to confirm this error. I can see from the documentation there is an 'X-Staticmap-API-Warning' key but its unclear if this is populated in this case.
Of course we'll be monitoring the usage via the Developer Console, but it would be good if we didn't have to rely on our customers reporting a problem should we see a spike.
Thanks in advance...
The HTTP-status of the image will be 403 when you see the error-image.
But that wouldn't help you much, because an <img/> doesn't have a property which gives you the HTTP-status.
Possible solution(works when the static map does have a size different to 100x100 ):
The error-image does have a size of 100x100, observe the onload-event and when the naturalWidth and naturalHeight is 100, do something:
<img src="staticmapurl"
onload="if(this.naturalWidth==this.naturalHeight==100){/*do something*/}"
/>
But note: there is also a quota for users, when google returns the error-image it must not be related to the quota of your project
I have a problem maybe someone had the same issue.
I am calling google places autocomplete api call.
Then i am presenting the user with the results and he can select the place.
Base on the selection i am making places details call and retrieve the details of the place.
My problem is that some cases the details service return NOT_FOUND. the full response looks something like this
{\n \"debug_info\" : [],\n \"html_attributions\" : [],\n \"status\"
: \"NOT_FOUND\"\n}\n
Based on google api documentation, NOT_FOUND for place details is:
NOT_FOUND indicates that the referenced location was not found in the Places database.
But i got this Reference just 1 sec ago from autocomplete service call!
Anyone has the same problem?
Thanks,
Noam
There are two indexes here, one for the autocomplete suggest and one for the map details. You are seeing the results of the two indexes being updated at different times. If you supply the address in question, I can confirm with the appropriate teams, or you can just wait a couple of days for the indexes to come back into sync.
It could also be due to the fact that the business is closed.
https://developers.google.com/maps/documentation/places/web-service/search-find-place#id-errors
I had a similar issue when using the Find Place endpoint. I would get a successful response and a place_id returned and then calling the Details endpoint would return a NOT_FOUND error.
After adding business_status to the fields on my initial request to the FindPlace endpoint would return:
GET https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=gtdc.org&inputtype=textquery&languagecode=en&fields=place_id,business_status&key={{googlePlacesApiKey}}&locationbias=circle:{{radius}}#{{latitude}},{{longitude}}
Response:
{
"candidates": [
{
"business_status": "CLOSED_PERMANENTLY",
"place_id": "ChIJ7buuHhrhwogR_eWFgXkNyjY"
}
],
"status": "OK"
}
Essentially you just have to ignore any results where the status is CLOSED_PERMANENTLY as these will not work on the details endpoint.
Unfortunately there doesn't seem to be any way of returning the business_status on the Autocomplete endpoint but might be the same issue you are seeing.