Getting 400 error ( invalid argument - latlng )while updating the location details via Google my business API - google-maps

I've a business published in Google My business.It is in live. I tried to update the location details via API. But I'm getting 400 error and getting the following response.
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
"errorDetails": [
{
"code": 3,
"field": "latlng",
"message": "The specified address cannot be located. Please use the UI to provide a pin drop."
}
]
}
]
}
}
But in the above scenario, patch request doesn't contains the location coordinates. But I still getting the specified address cannot be located response.
Body of patch request::
{
"primaryPhone": "xxxxxxxxx",
"locationName": "xxxx",
"address": {
"regionCode": "IN",
"postalCode": "xxxxx",
"locality": "xxxxx",
"addressLines": [
"xxxxxx xxxx xxxx"
],
"administrativeArea": "xxxx xxxxxx"
},
"primaryCategory": {
"displayName": "Apartment building",
"categoryId": "gcid:apartment_building"
},
"languageCode": "en",
"storeCode": "xxxxxx9dda0dc5-c709-410c-a272-912486b1b5f4"
}
This is doesn't contains the lat,lng but still getting the same lat,lng field error.
Actually I've changed the name only change . I don't know how it is related to lat,lng.
And tried updating without the address field and with address field. But in both case getting the same response.

Seems like you are using this method (https://developers.google.com/my-business/reference/rest/v4/accounts.locations/patch).
This error occurs when Google determines that their own Geocoder doesn't really know where they should be placing the pin for that address. So additionally to the address property, Google may(!) allow you to also send them the latLng property - if Google determines that this is a credible set of coordinates, the address will be updated.
It is however still possible that they won't believe you that you know where that address is exactly. In that case, the only way to get address data through is in fact to go to the Google My Business UI of the location and manually dragging that pin to where it needs to go.

Related

People API getting error when Age Ranges is specified

I have tried with People contact create API but I am getting error. I believe the ENUM data is correct
This happens for Skills and Age ranges
{
"error": {
"code": 400,
"message": "person.age_ranges is a read only field.",
"status": "INVALID_ARGUMENT"
}
}
People.People.createContact( {"skills": [
{
"value": "Playing"
}
],
"ageRanges": [
{
"ageRange": "TWENTY_ONE_OR_OLDER"
}
],
})
Answer:
The ageRanges[] field can not be set as it is a read-only field.
More Information:
As per the Person resource in the documentation:
ageRanges[]
object (AgeRangeType)
Output only. The person's age ranges
As this is an output only value, it can not be written to by calling people.createContact.

Google Cloud Platform can't add URI that ends with .web.app to Oauth Client ID

I have an existing client-id (Web) with some working UIDs, I added a time ago. I now wanted to add one more and when I press the save button it just does not work (ProgressIndicator is spinning infinitely). I have a working internet connection and tried with several browsers (Safari,Chrome).
Has anyone seen this?
Edit:
I just tried again with it. I got this error in the web console:
{
"error": {
"code": 400,
"message": "The request failed because one of the field of the resource is invalid.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.PreconditionFailure",
"violations": [
{
"type": "client_auth_config",
"subject": "?error_code=9&error_field_name=pending_domains&error_field_value=test-page.web.app"
}
]
}
]
}
}
When I added a domain that ended in .firebaseapp.com, everything worked. Since the domain I want to use ends in .web.app, I have a problem with this though.

Google My Business API - Use the UI to provide a pin drop

I am trying to update a listing on Google My Business with a new description, in doing this you have to update the whole listing. When trying to update the address I get the response;
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com\/google.mybusiness.v4.ValidationError",
"errorDetails": [
{
"code": 1100,
"field": "address",
"message": "The specified address cannot be located. Please use the UI to provide a pin drop."
}
]
}
]
}
The address is exactly the same as what has been retrieved from Google just 20 minutes earlier so there is no difference to what shows in Google. Is there any way to update this listing?
Google detail that you should use a UI to position the Map Pin to update the listing if this is done what is the new information provided back to Google?

Google Places API - Types different in autocomplete vs detail

Given the following API call to autocomplete:
https://maps.googleapis.com/maps/api/place/autocomplete/json?types=address&input=23%20norton%20st
I get the following response:
{
"predictions": [
{
"description": "23 Norton Street, Leichhardt, New South Wales, Australia",
"id": "9711c656faa60f77a05680b603523a4bc75c45be",
"place_id": "EjgyMyBOb3J0b24gU3RyZWV0LCBMZWljaGhhcmR0LCBOZXcgU291dGggV2FsZXMsIEF1c3RyYWxpYQ",
"types": [
"route",
"geocode"
]
},
...
],
"status": "OK"
}
Notice the types are of route and geocode. 
If I query the detail API:
https://maps.googleapis.com/maps/api/place/details/json?placeid=EjgyMyBOb3J0b24gU3RyZWV0LCBMZWljaGhhcmR0LCBOZXcgU291dGggV2FsZXMsIEF1c3RyYWxpYQ
I get the following:
{
"html_attributions": [],
"result": {
"id": "e698fdcd9dceed8fe42a926a19cb2b17d4f5f088",
"name": "23 Norton St",
"place_id": "ChIJpdXOTxewEmsRMmpMxLBgFpI",
"reference": "CmRbAAAAKmYoyR1BrFqFQJi6CAD8cjhD4SDnZXMIC0mOLOpX_jPgIgFv0TJ3rv8p5L9xKrplHzUFxBNc8sd7PdkXdnCsTo_7-3X7mocd8yHnXCIKYAxj0MO4icLoFJjD3DEszqK3EhD8XIu6zNH-h3hqotfKjmd-GhRwyNIfJCo4bmOOLYgubm7j8ln_tw",
"scope": "GOOGLE",
"types": [
"street_address"
],
"url": "https://maps.google.com/?q=23+Norton+St,+Leichhardt+NSW+2040,+Australia&ftid=0x6b12b0174fced5a5:0x921660b0c44c6a32",
"utc_offset": 600,
"vicinity": "Leichhardt"
},
"status": "OK"
}
The types and the place id are different from the first response. I would expect them to be the same, why are they different?
If you do the search for "23 Norton Street" rather than "23 Norton St" you actually get the results you'd expect (matching place_id, type etc). I think what is happening is that when you search for 23 Norton St it doesn't actually have a match (as St rather than Street) and so it performs a geocode lookup, and that's the result you see.
Is there any reason the result is causing problems for you? Or is it just an oddity/curiosity?
Not sure what your actual issue is, but it is possible for Google Places to actually have multiple IDs for one location. Reference: https://developers.google.com/places/place-id
Also it seems you may have your AutoComplete setup to only provide you back types regarding geocode and route as that is also an option for results. It's unknown without your actual code.
I'm sure you have been to the documentation here: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
but maybe you missed something in the example there. Hope that answers your 'question'!

Google image search api. Bad request

I'm using Google CustomSearch API v1 for image search but I have a problem with my JSON request.
When I filled out the search.cse.list (here) I got the JSON request like this:
GET https://www.googleapis.com/customsearch/v1?q=test&cref=AIzaSyAreDhTh3IqaGPqC44t08sQF_qbSGzzA7Q&cx=010855067127206535986%3Aqdh_vhglb4u&fileType=jpg&filter=1&imgSize=medium&imgType=news&num=4&searchType=image&start=1&key={YOUR_API_KEY}
And the response of this request:
{
"kind": "customsearch#search",
"url": {
"type": "application/json",
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
},
"queries": {
...
},
"context": {
...
},
"searchInformation": {
...
},
"items": [
{
"kind": "customsearch#result",
"title": "free student testing cartoons | Home > Clipart > Cartoons ...",
"htmlTitle": "free student <b>testing</b> cartoons | Home > Clipart > Cartoons <b>...</b>",
"link": "https://s-media-cache-ak0.pinimg.com/236x/30/0c/a5/300ca57d460ab787202e36bdf0364e57.jpg",
"displayLink": "www.pinterest.com",
"snippet": "free student testing cartoons",
"htmlSnippet": "free student <b>testing</b> cartoons",
"mime": "image/jpeg",
"image": {
"contextLink": "https://www.pinterest.com/pin/568157309212095926/",
"height": 213,
"width": 236,
"byteSize": 14426,
"thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ-JefdKWd1WZkuesaq01zldYRW2JmYd_z0cW0SF9OEXFMVr6M8XZO4kg",
"thumbnailHeight": 98,
"thumbnailWidth": 109
}
},
But when I tried to use this request at the browser bar I got an error:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
}
}
I guess that I should use Ajax call, but I dont know how can I do it, because I am beginner.
I also made an API Key, "cx" and have enabled CustomSearch API at my console.developer account.
So the question is: How can I get values from this JSON request and then operate with them if I even cant get values in my browser? I want to get an image-link from this request.
Sorry for my English.
The Google Image Search API was deprecated in 2011, and has finally, now, been switched off :( You'll have to find something else to use, sorry :(