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

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?

Related

How can I get my Google Groups via API? I am NOT admin

I want to get all my groups but I am not an admin
I know how to fetch groups if I am admin. But if not - I don't understand. Also I can see its via website
My steps:
I do auth with Google and with scope
[
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/groups",
]
I fetch groups by GET. Url: "https://admin.googleapis.com/admin/directory/v1/groups?domain=konstructly.com"
I get the next problem:
{
"error": {
"code": 403,
"message": "Not Authorized to access this resource/api",
"errors": [
{
"message": "Not Authorized to access this resource/api",
"domain": "global",
"reason": "forbidden"
}
]
}
}
My question
How can I get my Google Groups via Google API?
I tried:
Auth with scope
[
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/groups",
]
GET "https://admin.googleapis.com/admin/directory/v1/groups?domain=konstructly.com"
Expectation:
List of my groups
Actual result:
{
"error": {
"code": 403,
"message": "Not Authorized to access this resource/api",
"errors": [
{
"message": "Not Authorized to access this resource/api",
"domain": "global",
"reason": "forbidden"
}
]
}
}
Instead of using the Google Workspace Admin SDK, use the Groups Service from Google Apps Script, more specifically GroupsApp.getGroups()

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

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.

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 Drive API v3: how to set canCopy capabilities on a file

I want to limit the capabilities of a file in personal Google Drive. When I use the API explorer Google Drive v3 API with the following request:
POST https://www.googleapis.com/drive/v3/files?key={YOUR_API_KEY}
{
"capabilities": {
"canCopy": false
},
"name": "testfile"
}
I get the following response:
403
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "fieldNotWritable",
"message": "The resource body includes fields which are not directly writable."
}
],
"code": 403,
"message": "The resource body includes fields which are not directly writable."
}
}
Which is the same response that I get when trying to update a file with:
PATCH https://www.googleapis.com/drive/v3/files/FileIdHere?key={YOUR_API_KEY}
{
"capabilities": {
"canCopy": false
}
}
It seems that there are no methods to accomplish this or has anyone a workaround?
If you check file resource you will notice that some fields are writeable while others are not.
The message you are seeing is because the field you are trying to set is not writeable this means you can not change it from the API

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 :(