Google My Business API - How to extract logo and cover with new API version - google-my-business-api

I have to retrieve the logo and cover from the Google My Business Locations and I would like to understand which kind of API I should call.
To get the locations list I've called the accounts.locations.list and the REST services give me back the correct results with a lot of data.
But these results do not contain the media logo and cover, and reading the documentation I've seen this page accounts.locations.media.list but it refers to the old API with a hostname "mybusiness.googleapis.com" while the other is "mybusinessbusinessinformation.googleapis.com", and calling it with the OAuth 2.0 Playground the service returns this error:
{
"error": {
"status": "PERMISSION_DENIED",
"message": "Google My Business API has not been used in project 711831863231 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=711831863231 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"code": 403,
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=711831863231",
"description": "Google developers console API activation"
}
]
},
{
"reason": "SERVICE_DISABLED",
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"domain": "googleapis.com",
"metadata": {
"consumer": "projects/711831863231",
"service": "mybusiness.googleapis.com"
}
}
]
}
}
so I thought that I needed to add the API on the Google Console page but all the My Business API are enabled and I don't see a generic My Business or a specific Media API to add.
I think this API might be disable as showed on the response with the label "SERVICE_DISABLED" but I can't understand which API I have to call to extract this information (logo and cover, but also the other media linked with the location).

Related

Microsoft Graph API - Search email using application permission

I want to search email using Graph API in my own developed application. By referring to these threads - Graph Api: Region is required when request with application permission , How to use Graph API Sharepoint Search from console app , Search content with application permissions , I tried to run the search which resulted in Application permission is only supported for the following entity types:site, list, listItem, drive and driveItem. (Request and response json is below).
Does it mean that using an app like a console application developed in C# will not be able to search the emails (as message is not mentioned in error response - only these are mentioned: site, list, listItem, drive and driveItem) even if it has required secret, auth token and permissions?
Request:
URL : https://graph.microsoft.com/beta/search/query
Request Payload:
{
"requests": [
{
"entityTypes": [
"person"
],
"query": {
"queryString": "contoso"
},
"Region" : "NAM",
"from": 0,
"size": 25
}
]
}
Response:
{
"error": {
"code": "System.UnauthorizedAccessException",
"message": "Application permission is only supported for the following entity types:site, list, listItem, drive and driveItem.",
"target": "",
"httpCode": 403
},
"Instrumentation": {
"TraceId": "7174e417-a2fe-02e5-1523-1fcda7a66886"
}
}

I can't get this Google Sheets API Get request to work

I am trying to have a game to request data from the Google Sheets API, and I can't get the API Key to function properly. I can visit my API Link in the browser, and it tells me it is getting HTTP 400 (Bad Request) and Google additionally says it's a bad API Key, despite having JUST generated it. For reference my link looks like this: "https://sheets.googleapis.com/v4/spreadsheets/[SHEET_ID]?key=[API_KEY]/values", and the browser views this when using it:
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "sheets.googleapis.com"
}
}
]
}
}
I have absolutely no idea what is going wrong, I know the API key and Sheet ID are right (Directly copied each from their respective source).

Microsoft Graph - Accessing /me or /user/{id}/ endpoints using client_credentials flow - requested user is invalid

We're using the client_credentials flow to get access for our application to tenants environments. The application has the correct scopes, and we get an access token that is working for other endpoints like /users but when doing a request like the following we get error messages.
GET https://graph.microsoft.com/beta/me/findRooms
{
"error": {
"code": "ErrorInvalidUser",
"message": "The requested user '{userId}#{tenantId}' is invalid.",
"innerError": {
"request-id": "b72d26a3-d0ad-42eb-a3d3-35951cb42b3d",
"date": "2020-01-21T10:21:28"
}
}
}
I understand that there's no "me" when we're just an application, but how do we access these types of endpoints in that case? Do I have to have a user to act as, as well? That seems to me like it defeats the purpose of a daemon like this. Cannot find any clear documentation on this matter. On this page in the docs on the use a token section they even refer to a /me endpoint, which is incorrect in that case.
I've tried requesting the /users/{id}/findRooms endpoint with all different kinds of ID's I can find in the access token - none of them work.
Other people with the same issue, that have yet to resolve it.
1. Feedback area in docs
2. Github issue
Best regards,
Christopher
Using the /users/{user-id} is the only pattern that will work with client credentials. In your case, this should work, so maybe it's an issue with the id you are using.
To make sure I'm not giving you bad information, I just tested this with an app-only token from the client credentials flow. Parsing that token over at https://jwt.ms, I see the roles claim like so:
"roles": [
"User.Read.All"
]
If first did a GET /users?$select=displayname,id, and this user was included in the response:
{
"displayName": "Adele Vance",
"id": "3103c7b9-cfe6-4cd3-a696-f88909b9a609"
}
This is the id to use in your findRooms call. I did GET /users/3103c7b9-cfe6-4cd3-a696-f88909b9a609/findrooms and got the following response:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.emailAddress)",
"value": [
{
"name": "Conf Room Adams",
"address": "Adams#M365x330971.onmicrosoft.com"
},
{
"name": "Conf Room Baker",
"address": "Baker#M365x330971.onmicrosoft.com"
},
{
"name": "Conf Room Crystal",
"address": "Crystal#M365x330971.onmicrosoft.com"
},
{
"name": "Conf Room Hood",
"address": "Hood#M365x330971.onmicrosoft.com"
},
{
"name": "Conf Room Rainier",
"address": "Rainier#M365x330971.onmicrosoft.com"
},
{
"name": "Conf Room Stevens",
"address": "Stevens#M365x330971.onmicrosoft.com"
}
]
}

Google My Business API fails

Getting a strange error message and there is literally nothing on it anywhere I look. Granted access to Google My Business API, followed directions here;
https://developers.google.com/my-business/content/get-started
All went well, but the expected 200 response was actually the below;
{
"error": {
"status": "PERMISSION_DENIED",
"message": "The request was blocked. Quota configuration not found for the requesting project.",
"code": 403,
"details": [
{
"violations": [
{
"description": "The request was blocked. Quota configuration not found for the requesting project.",
"subject": "project:XXXXXXXXXX"
}
],
"#type": "type.googleapis.com/google.rpc.QuotaFailure"
}
]
}
}
Anyone have any idea how to add quotas in Google Developer console, or, alternately, if this message is a result of expired permissions perhaps? (Granted access in Feb, did not use until now?)
This is what you get when the project in question does not have Google My Business API access, as granted through their official process etc. When I used the correct project I got a 200 and all is well.
So sayeth the GMB folks themselves, who answered my email same day!

Google+ Domains API Not Configured

When I try to post an activity to Google+ I get the error:
{
"error": {
"code": 403,
"message": "Access Not Configured. The API (Google+ Domains API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
"errors": [
{
"domain": "usageLimits",
"message": "Access Not Configured. The API (Google+ Domains API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
"reason": "accessNotConfigured",
"extendedHelp": "https://console.developers.google.com"
}
]
}
}
I know this question has been asked before here, but I have a different message in my error. I've also enabled Google Domains API in the console. I'm using a Gmail account and I also receive circles and contacts information with the following scopes:
https://www.googleapis.com/auth/userinfo.email
https://www.google.com/m8/feeds https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/plus.stream.write
https://www.googleapis.com/auth/plus.me
My Post body is:
{
"object": {
"originalContent": "Happy Monday! #caseofthemondays"
},
"access": {
"items": [
{
"type": "domain"
}
],
"domainRestricted": true
}
}
Found out this feature is only available for Google Apps customers not anyone else.
Reference
Have you created (or using) the API_KEYs in your Google project?
If not, go to Google developer console and select the credentials section under APIs & Auth and create the API key relevant for your application.
If you already have a key, try regenerating a new one

Resources