Get list of accounts via Google Business API - google-my-business-api

Ultimately, I am trying to get all reviews for a business location.
I have gone through the basic setup guide here https://developers.google.com/my-business/content/basic-setup
I have access to the project in Google Cloud Platform and am a manager in Google My Business.
To test things, I am using the OAuth 2.0 Playground. I tried calling https://mybusinessaccountmanagement.googleapis.com/v1/accounts but it just returns details of my own account:
{
  "accounts": [
    {
      "vettedState": "NOT_VETTED",
      "type": "PERSONAL",
      "name": "accounts/1234567890",
      "verificationState": "UNVERIFIED",
      "accountName": "account name"
    }
  ]
}
I was expecting to see details of the business account?
I tried calling https://mybusiness.googleapis.com/v4/accounts/1234567890/locations/qwertyuiop/reviews but get this:
{
  "error": {
    "status": "NOT_FOUND",
    "message": "Requested entity was not found.",
    "code": 404
  }
}
This feels like a permissions problem but I cannot find any information about the requirements or any helpful information at all!
Can anyone help?

The Bearer authorization token needs to generated using the Google account that actually has access to the locations. You seem to be using your personal Google account. Please take a look at the basic setup guide from the documentation on making a simple HTTP request:
Steps 1-6 are about your application and the general access to the GBP APIs.
Step 7-8 are about using the Google account that actually has access to the location data. So here, you need to use the business's Google account that has location ownership.

Related

Remove scopes from Firebase OAuthProvider('google.com')

I am using a vanilla configuration of the firebase Auth SDK. It is currently asking for all of these scopes.
I do not need profile picture or name, and would love to remove them. Is it possible?
Simple answer is No name, and picture permissions are granted to your application when you request the profile scope as part of signin.
explanation
Assuming you are following the example found here. If you check the lines called addScopes.
provider.addScope('profile');
provider.addScope('email');
This is where you define what permissions your applicating needs. The email and profile scopes are part of Google sign in (Open Id Connect) The profile scope give you access to some basic profile information about the user. Part of basic profile information is their picture.
These two claims are actually returned by the user info endpoint. This is the response from the userinfo endpoint when I authorized only with the profile scope.
{
"family_name": "Lawton",
"name": "Linda Lawton",
"picture": "https://lh3.googleusercontent.com/a-/AOh14GhroCYJp2P9xeYeYk1npchBPK-zbtTxzNQo0WAHI20=s96-c",
"locale": "en",
"given_name": "Linda",
"id": "1172004755376"
}
This is all default, so its not something you can change.
full example
// Using a redirect.
firebase.auth().getRedirectResult().then(function(result) {
if (result.credential) {
// This gives you the OAuth Access Token for that provider.
var token = result.credential.accessToken;
}
var user = result.user;
});
// Start a sign in process for an unauthenticated user.
var provider = new firebase.auth.OAuthProvider('google.com');
provider.addScope('profile');
provider.addScope('email');
firebase.auth().signInWithRedirect(provider);

Solved: No results for /sites?search= using Microsoft Graph

Using Microsoft Graph, I want to search for SharePoint sites containing specific names and moreover I want to get a list of all SharePoint sites.
I am using the following URL in the Graph Explorer:
https://graph.microsoft.com/v1.0/sites?search=test
or
https://graph.microsoft.com/v1.0/sites?search=*
When using an account from Company A everything works. I receive a list of all results.
But when using an account from Company B, I get a 404 NOT FOUND response for all queries (although there should be multiple results):
{
"error": {
"code": "itemNotFound",
"message": "Item not found",
"innerError": {
"date": "2022-01-01T14:59:35",
"request-id": "xxxxxx",
"client-request-id": "xxxxxx"
}
}
}
Maybe it has something to do with the rights of the users?
I tested with "normal" users at both companies.
Edit:
I also get an error (403 Access denied) using the following url:
https://graph.microsoft.com/v1.0/sites/root
But when accessing a specific site by it's id, everything works.
Edit 2
I noticed a relationship with the permissions of the root SharePoint site. If the user has no permission for that site, the mentioned queries are not working. I need to contact the admin of the system to check my suspicion.

Client-side pagination using $skip/$top does not work with Intune

We are currently working on a client application that processes Intune devices by querying all devices on a customer account using the following Microsoft Graph API:
GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices
After we migrated from our test environment to a Production account we discovered that manual pagination of devices using $skip and $top does not work as per the relevant Microsoft Graph API OData documentation.
As per the said documentation:
$skip: Indexes into a result set. Also used by some APIs to implement paging and can be used together with $top to manually page results.
However, the following query returns an empty result despite there being thousands of devices registered
on the target customer account:
GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=10&$skip=10
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices",
"#odata.count": 10,
"#odata.nextLink": "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=10&$skip=10",
"value": []
}
Also, we found that OData $filter does not work either as demonstrated by the following snippet which queries for devices with operatingSystem equal to 'Android':
GET 'https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=100&filter=operatingSystem%20eq%20%27Android%27'
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/managedDevices",
"#odata.count": 100,
"#odata.nextLink": "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$top=100&$skip=0&filter=operatingSystem+eq+%27Android%27",
"value": [
{
"id": "5bac965e-25e3-4f99-97fb-da21a280f684",
"userId": "some-uuid-value",
"deviceName": "My Iphone",
"managedDeviceOwnerType": "company",
"enrolledDateTime": "2020-02-05T09:52:39Z",
"lastSyncDateTime": "2020-10-19T17:07:20Z",
"operatingSystem": "iOS",
...
We have tested using both v1.0 and beta versions of the said API to no avail. Has anybody got this working?

Firestore REST API with Firebase Id token

I am trying to create new document at firestore, using bearer token, retrieved from from Auth SDK (ios, but actually I am using FirebaseAuth for osx, that's why I have no other choose except using REST, because there is no FirebaseFirestore support for osx).
The rules are
service cloud.firestore {
match /databases/{database}/documents {
match /places {
allow create, update, delete, read: if true;
}
}
}
For retrieving token
Auth.auth().currentUser?.getIDTokenForcingRefresh(true, completion ..
After I get token as a string and put it to header Authorization: Bearer MY_RETRIEVED_TOKEN
Link I requesting
https://firestore.googleapis.com/v1beta1/projects/MYPROJECTID/databases/(default)/documents/places?fields=fields&documentId=kk&key=API_KEY_FOR_WEB_APP_FROM_FIREBASE_PROJECT_SETTING
So here I am passing key from Firebase project settings for Web
Body of this POST request
{
"fields": {
"nn": {
"stringValue": "hhh"
}
}
}
But it the end I get 403 in response.
{
"error": {
"code": 403,
"message": "Missing or insufficient permissions.",
"status": "PERMISSION_DENIED"
}
}
Already broken up my mind trying to find an error. Thanks in advance!
I had the same problem few days ago.
You should try to modify your rules like code bellow:
service cloud.firestore {
match /databases/{database}/documents {
match /places/{document=**} {
allow create, update, delete, read: if true;
}
}
}
In this case you set rules for all document's of places.
Also you can test your rules in Rules Simulator. This works quite good.
I hope this will help you

Get Recommendation from LinkedIn API returns empty map [:] as response

I have created a web application from which I am trying to get recommendations of a user from his/her LinkedIn Profile using URL
String url="https://api.linkedin.com/v1/people/~:(recommendations-received:(id,recommendation-type,recommendation-text,recommender))?format=json"
When I am using this URL in the
Api Explorer it works fine. And gives output:-
{ "recommendationsReceived": {
"_total": 2,
"values": [
{
"id": 558598601,
"recommendationText": "xxx is among the best team players I ever worked with. He has handled client effectively with smooth operations. I had always seen him as person with solution mindset and always look for solution rather than thinking about the problem. ",
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXX"
}
},
{
"id": ZZZZ,
"recommendationText": "XXX is one of the most dedicated person at work.I always him with a flexible attitude and ready to adapt himself in all situation.I have seen him work all night to catch up all the deadlines and deliver on time ."
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXXX"
}
}
] } }
The problem comes, when I am using this URL in my Developer app.It doesn't give any error just simple return an empty map [:] as output in response
Irrespective of these recommendation fields, I successfully get the user basic profile data such as email, id, image,firstName,lastName.Means my code is working for other fields well but not for these recommendation fields*
To find the solution, I did some internet surfing and find a link of Linked API docs
Linked API Docs
As per Docs following selection of profile fields are only available
to applications that have applied and been approved for the Apply with
LinkedIn program:
Recommendation Fields
I already created a LinkedIn Developer account to get key & Secret
So how do I apply and get approval for Apply with LinkedIn Recommendation Fields.
I already have seen the LinkedIn support but can't find the way to ask question to the Linked Developer help support
Please suggest me the right way.
After a long internet surfing,I have found something fruitful that, I have to fill up a form to get these fields.Here is the form
along with its procedural details
You can use just recommendations-received keyword. Try the following link. I am getting all recommendations details with this link.
https://api.linkedin.com/v1/people/~:(recommendations-received)?format=json

Resources