I want to know how can I use GMB API to fetch reviews. According to google documentation we have to make a GET request to https://mybusiness.googleapis.com/v3/{name=accounts/*/locations/*}/reviews
But what is meant by {name=accounts/*/locations/*} and from where we can get the value of accounts & locations.
Also this requires OAuth 2.0. If I get a access_token then GET request will be like this:-
https://mybusiness.googleapis.com/v3/{name=accounts/*/locations/*}/reviews?access_token=token
This is very confusing. Can somebody tell me how to use GMB API correctly to fetch google reviews.
Using Google OAuth 2 Playground
For testing acquisition of Google reviews
Create a project
Console.cloud.google.com
Sign in as {projectowner}#google.com
Select a project from the dropdown in the header or click new project
Go to APIs & Services in the left menu
Enable the Google My Business API; this requires validation by Google and may take a couple of days. They will email you.
Go to developers.google.com/oauthplayground
Using the settings gear, set OAuth flow to Client-side and click Use your own OAuth credentials
Get the client id from console.developers.google.com/apis and paste it in
Put this into scope: https://www.googleapis.com/auth/plus.business.manage and authorize it with {projectowner}#gmail.com
Exchange auth code for token
To get the account name:
Set Request URI to https://mybusiness.googleapis.com/v4/accounts and send a Get request
Copy the entire string value at “name”: not including quotes; it may be 20+ numeric digits
To get location names:
Set Request URI to https://mybusiness.googleapis.com/v4/accounts/{paste account name here}/locations where {paste ... here} is the account name you copied
The returned JSON contains all of your locations
Copy the location names including quotes and commas to a temporary holding document; they will be used in a JSON array in the next step
To get multiple locations’ reviews
a. Set Request URI to https://mybusiness.googleapis.com/v4/accounts/{account name here}/locations:batchGetReviews and the Method to Post
b. Set Request Body to
{
"locationNames": [
"accounts/999999999999999999999/locations/88888888888888888888",
"accounts/999999999999999999999/locations/77777777777777777777",
.
.
.
"accounts/999999999999999999999/locations/11111111111111111111"
],
"pageSize": 200,
"orderBy": "updateTime desc",
"ignoreRatingOnlyReviews": false
}
using the account names you saved from the location JSON for each line of the array
If you have more than 200 total reviews you will have to add "pageToken": string into the JSON body where string is a value returned in the preceding POST.
But what is meant by {name=accounts//locations/} and from where we can get the value of accounts & locations.
To get this details first get the account using the following API (https://mybusiness.googleapis.com/v4/accounts?access_token=#####)
Once you have the account list, fetch Account Location list using the following API (https://mybusiness.googleapis.com/v3/" + name + "/locations) in the response of this API you will get the {name=accounts/*/locations/*}.
Also this requires OAuth 2.0. If I get a access_token then GET request will be like this: https://mybusiness.googleapis.com/v3/{name=accounts/*/locations/*}/reviews?access_token=token
Yes, that is correct.
Let me know if this work's for you.
Related
The MS Graph rest API surfaces a resourceProvisioningOptions attribute to indicate whether a MS365 group is also a Team (see below). However, those values do not appear to be available in the GraphServiceClient.
I found this post, and used the sites endpoint to get the associated SharePoint URL for an M365 group. But some M365 groups have SharePoint sites and are not Teams.
The only other option I found was to use the teams endpoint and catch the exception when no team is found for the group ID. But then I still have to do the additional sites endpoint query to get the SharePoint URL.
Does anyone know of another/better way to distinguish between Team/non-Team M365 groups when using the GraphServiceClient?
I'd like to pile on to the helpful post by Baker_Kong.
This functionality is available in both the beta and v1.0 endpoints. It is not described in the v1.0 metadata (which we use to generate the model) and that is why you aren't seeing this in the object model. Until this is resolved, you could use the beta client or:
// Get only groups that have teams.
var groupsThatHaveTeams = await client.Groups.Request().Filter("resourceProvisioningOptions/Any(x:x eq 'Team')").GetAsync()
// When the metadata is fixed, each group will have a ResourceProvisioningOptions property that you can inspect for the 'Team' value.
// Until then, you'd need to look at the Group.AdditionalData dictionary for the resourceProvisioningOptions key and check if it has the 'Team' value.
var groupsThatMayHaveTeams = await client.Groups.Request().Select("id,resourceProvisioningOptions").GetAsync();
cross posted from https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/44#issuecomment-752775347
#Tracy,
I have a test the SDK in a console app, I believe this property is under the group entity:
or you can add select option to omit the returned properties:
graphClient.Groups.Request().Select("id,resourceProvisioningOptions").GetAsync().Result;
BR
I've implemented social authentication in my application, and I get the accesstoken successfully.
But when I use that access token to get the user's public profile, I get only the user's ID and the user's name.
I can't get the other properties of the user like the user's profile picture.
when I try this:
Json = await httpClient.GetStringAsync($"https://graph.facebook.com/v5.0/{userWithOnlyId.Id}?access_token={accessToken}");
I get only the user's id and name.
when I do this as stated in this facebook doc :
await httpClient.GetStringAsync(
$"https://graph.facebook.com/me?fields=profile_pic&access_token={accessToken}");
I get a 403 forbidden error.
Is there something I did wrong ? I've tried several things I found here on stackoverflow but up till now I have no solution.
There is an example(section: Retrieving a Person's Profile):
https://graph.facebook.com/<PSID>?fields=first_name,last_name,profile_pic&access_token=<PAGE_ACCESS_TOKEN>
Looks like you need to provide a PSID
ASID(App-scoped ID) - it's a user-id that is unique for each app.
It means that this user will have different ASID for each app. I think that you have only one app.
To get a Page-scoped ID from an App-scoped ID, send a POST request to
the /pages_id_mapping root node
I am using Elizabeth's wrapper from https://github.com/mozts2005/ZendeskApi_v2
I want to pull a list of agents. I don't see any built in Function that will allow that.
I have tried using the endpoint of /api/v2/users.json?role=agent with the GetAllUsers() function but it still returns all of them.
Right now, I am going to add a custom field to be able to search for them, but that should not be the case, especially since Zendesk's API does have an option for returning users based on their role: /api/v2/users.json?role[]=admin&role[]=end-user
Can anyone help me out?
You can give a try to the Zendesk Search API:
from urllib.parse import urlencode
import requests
results = [] # Empty list to collect pagination results
credentials = 'your_zendesk_email', 'your_zendesk_password'
session = requests.Session()
session.auth = credentials
params = {
'query': 'type:user role:agent'
}
url = 'https://your_subdomain.zendesk.com/api/v2/search.json?' + urlencode(params)
while url:
response = session.get(url)
data = response.json()
results += data['results']
url = data['next_page'] # should return false according to the doc when the last page is reached
Useful resources:
zendesk api python tutorial
zendesk api pagination
Search endpoint seems to be supported also in the c# library you are using.
I've been searching the Graph API Explorer and documentation for a long time, but I really can't find anything.
I need a simple GET request like the me/subscribes just with page-id/subscribers or something like that. Does anyone know the get I must send to get a Count of subscribers of a page?
BTW I'm using Facebook SDK and I'm using this as GET:
var fb = new FacebookClient(useraccesstoken);
dynamic result = fb.Get("i want to get subscribers of a page id what to do??");
The /me/subscribers end-point was available to users' only, and has since been removed with Graph API 2.0, along with the user_subscriptions permission.
You can get a count of the subscribers / likes for a page as follows:
/{page-id}?fields=likes
This will return an a count for the total number of likes for a given {page-id}:
{
"likes": 123456,
"id": "{page-id}"
}
Trying to access the subscribers of a page is the same as trying to access all the users that have liked the page, which Facebook doesn't allow.
I am developing a server application that should be able to react to the amount of likes for some of the posts in the user's feed.
I need to get post from users wall.
I'm using Facebook library version 6.4.2
I use the following code to get the posts:
var apiKey = ConfigurationManager.AppSettings["apiKey"];
var secret = ConfigurationManager.AppSettings["secret"];
var client = PostHandler.CreateFacebookClient(apiKey, secret);
var get = client.Get(string.Format("/{0}/feed", pageId));
and/or (both return the same info)
var token =ConfigurationManager.AppSettings["token"];
var get = client.Get(string.Format("/{0}/feed?access_token={1}", pageId, token));
The problem is that using the same set of permissions the json returned from the request above is different from the json returned from json returned from Graph API Explorer methog GET 100000481752436/feed
In my opinion the json returned from my request is missing some posts and the one from the Geaph API all contains the posts from my feed.
Could you please advice, what could I have missed ?
If you are missing some posts in the feed it is most likely that you'll have to check the permissions set again.
Based on the type of posts you are missing you maybe have to add the user_status, user_activities, user_friends, user_checkins or user_games_activity permissions. Please make sure that you're using the correct set of the permissions for your particular task.
If you'll specify the type of the posts you are missing you may get much more helpful answers.