我正在做一个应用程序,我使用google places API提取谷歌评论.当我在" https://developers.google.com/maps/documentation/javascript/places "中阅读与其相关的文档时,我发现我可能只有5个热门评论.有任何选项可以获得更多评论.
我想访问与我的帐户及其评论相关联的位置,因为我使用的是Google my business API,我可以访问它(它可以在oAuthplayground上运行).
现在我想访问google my business api而不登录我的帐户,因为我试图让它与服务帐户一起使用.但到目前为止还没有运气,请建议如何继续这样做.我在服务帐户中启用了G套件,并且我还尝试访问我的业务管理的服务帐户电子邮件(ID),但它仍然处于" 邀请"状态,因为无法实际接受邀请.
当我尝试使用我的帐户作为主题发送请求时.
$client = new Google_Client();
$client->addScope('https://www.googleapis.com/auth/plus.business.manage');
$client->setAuthConfig(dirname(__FILE__) . '/Xyz Review API-service account.json');
$client->setSubject('xyz*****abc@gmail.com');
$business_service_class = new Google_Service_Mybusiness($client);
$result_accounts = $business_service_class->accounts->listAccounts();
echo json_encode($result_accounts);
exit;
Run Code Online (Sandbox Code Playgroud)
回复:{"nextPageToken":null}
如果我在主题中使用Google服务帐户ID作为电子邮件ID,那么我会得到以下回复.
$client->setSubject('xyz-review-service@xyz-review-api.iam.gserviceaccount.com');
Run Code Online (Sandbox Code Playgroud)
响应:错误500 {"error":"unauthorized_client","error_description":"请求中未经授权的客户端或范围".}
如果我这样做完全错了,那么请建议如何继续这样做.谢谢.
我正在开展一个项目,我们希望通过GMB API收集有关GMB性能的数据.这需要捕获许多reportInsights结果.我们不会为此帐户创建或更新任何记录.然而,我尝试了Oauth2方法,这要求我提供权限,因为我们不访问或更新任何用户数据,我想避免Oauth.
从文档和本用例中,我认为服务帐户是最好的方法,我在Google API控制台中创建了该凭据.
我可以创建凭据,但是,当我运行该进程时,我收到以下错误:
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://mybusiness.googleapis.com/$discovery/rest?version=v3 returned "The request is missing a valid API key.">
Run Code Online (Sandbox Code Playgroud)
这看起来很奇怪,因为我有一组有效的服务帐户凭据.我确实包含了来自Google API控制台的有效API密钥,但我收到了同样的错误.
这是我的Python代码:
import os
import httplib2
import json
import argparse
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
api_name = 'mybusiness'
api_version = 'v3'
api_key = '<my valid api key from google api console that has permission for this GMB project>'
discovery_uri = 'https://mybusiness.googleapis.com/$discovery/rest?version={}'.format(api_version)
flow_scope='https://www.googleapis.com/auth/plus.business.manage'
credentials_file = '/Google_My_Business-service_account.json' # the service account credentials from the Google API …Run Code Online (Sandbox Code Playgroud) 我正在使用 Google MyBsiness API 来获取所有业务评论。但我无法熟悉 MYBusiness 中使用的 PHP 语法和 GET、POST 方法。
在誓言之后,这里是我用来获取评论的代码
$mybusinessService = new Google_Service_Mybusiness($client);
$accessToken = file_get_contents($credentialsPath);
$reviews = $mybusinessService->accounts_locations_reviews;
echo '<pre>';print_r($reviews->get('ArtechDev'));exit;
Run Code Online (Sandbox Code Playgroud)
但我收到错误 404(致命错误:未捕获异常 'Google_Service_Exception' 带有消息)
我确定我不知道如何传递 param 以及它需要哪些东西。我以位置为“ArtechDev”的帐户登录,也请告诉我我可以在哪里打电话
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
谢谢
我在我们的平台中集成了 GMB API,并与 PubSub 合作以获取实时评论通知。
为此,我已经完成了以下步骤:
问题:
这是我从谷歌的文档中得到的。
任何回应都受到高度赞赏。
谢谢 :)
我正在使用 Google 我的商家 API。我需要检索位置个人资料图像或位置徽标 url。
根据我需要MediaItem使用 EnumPROFILE或LOGO
问题是我发现只有批量请求:
GET https://mybusiness.googleapis.com/v4/{name=accounts/*/locations/*/media/*}
Run Code Online (Sandbox Code Playgroud)
它返回所有位置媒体(任何枚举)。
在这种情况下,我必须运行响应才能找到我正在搜索的项目,并且可能需要运行多个请求才能访问下一个提要页面。
我认为这种做法是不合理的。
也许我错过了一些东西,那么有什么办法可以通过一个请求得到我想要的东西吗?
提前致谢!
我正在尝试使用服务帐户通过 Google 我的商家 API 检索位置/评论。
到目前为止我有:
当使用 Google 的示例 .NET 客户端(可从https://developers.google.com/my-business/sampleshttps://mybusiness.googleapis.com/v4/accounts/[ACCOUNT NAME]/invitations下载)以编程方式列出邀请时,我可以看到邀请
但是,当我尝试通过请求接受邀请时,请求https://mybusiness.googleapis.com/v4/accounts/[ACCOUNT NAME]/invitations/[INVITATION NAME]:accept失败并出现 500 服务器错误。
创建MyBusinessService实例时,我首先创建一个服务帐户凭据,例如:
ServiceAccountCredential credential;
using (Stream stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read, FileShare.Read))
{
credential = (ServiceAccountCredential)GoogleCredential
.FromStream(stream)
.CreateScoped(new [] { "https://www.googleapis.com/auth/plus.business.manage" })
.UnderlyingCredential;
}
Run Code Online (Sandbox Code Playgroud)
接下来我创建一个初始化程序,例如:
var initializer = new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "My GMB API Client",
GZipEnabled = …Run Code Online (Sandbox Code Playgroud) 我正在使用 API google mybusiness 来检索帐户位置中的评论。在评论内容中,Google 包含“(由 google 翻译)”,后跟翻译后的文本。有什么办法可以删除这个,我的意思是只获取用户的原始文本,而不需要这个翻译。
谢谢
我正在尝试为谷歌我的业务创建一个平台,并且我已经实现了一键登录,并且我获得了凭据,但没有获得完整的信息。这是我尝试过的代码
\n <script>\n window.onload = function () {\n google.accounts.id.initialize({\n client_id: "clientid.apps.googleusercontent.com",\n callback: handleCredentialResponse,\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log("opted out");\n }\n });\n function handleCredentialResponse(response) {\n console.log(response)\n // window.location = "https://github.com/";\n }\n };\n </script>\nRun Code Online (Sandbox Code Playgroud)\n这是我收到的回复
\n{\n clientId:\n "clientid.apps.googleusercontent.com",\n credential:\n "eyJhbGciOiJSUzI1NiIsImtpZCI6ImYwNTQxNWIxM2FjYjk1OT\xe2\x80\xa640Jk8v3LcOvtopFD_tI2HMlFjg0dK96XrqNiOD0H3Akl",\n select_by: "user",\n};\nRun Code Online (Sandbox Code Playgroud)\n { "error": { "code": 429, "message": "配额指标 'Requests' 超出配额,并限制消费者 'project_number:xxx' 服务 'mybusinessaccountmanagement.googleapis.com' 的 'Requests per minute'。 , "errors": [ { "message": "配额指标 'Requests' 超出配额,并限制消费者 'project_number:xxx' 服务 'mybusinessaccountmanagement.googleapis.com' 的 'Requests per minute'。", "domain": "global", "reason": "rateLimitExceeded" } ], "status": "RESOURCE_EXHAUSTED" } }
为什么我登录后立即收到这样的消息?我还没来得及使用api