google-api-php-client 相关问题

适用于PHP的Google API客户端库提供对许多Google API的访问。它专为PHP客户端应用程序开发人员设计,提供简单,灵活,强大的API访问。

Google PHP API 客户端和融合表:如何使用 importRows?

Google API php 客户端版本 0.6.3 似乎支持 importRows 命令: 公共函数 importRows($tableId, $optParams = array()) { $params = array('tableId' => $tableId); $p...

回答 1 投票 0

使用 google-api-php-client 创建通知通道

我想创建一个通知通道,以便每次从我的工作区删除用户时我的 php 应用程序都会收到通知,我正在使用以下命令 我想创建一个通知通道,以便每次从我的工作区删除用户时我的 php 应用程序都会收到通知,我正在使用以下内容 <?php namespace App\Services; use App\Models\Student; use Exception; use Google\Service\Directory\Channel; use Illuminate\Support\Str; class WorkspaceAdminService { /* * Email address for admin user that should be used to perform API actions * Needs to be created via Google Apps Admin interface and be added to an admin role * that has permissions for Admin APIs for Users */ protected string $delegatedAdmin; /* * Some name you want to use for your app to report to Google with calls, I assume * it is used in logging or something */ protected string $appName; /* * Array of scopes you need for whatever actions you want to perform * See https://developers.google.com/admin-sdk/directory/v1/guides/authorizing */ protected $scopes = array( \Google\Service\Directory::ADMIN_DIRECTORY_USER, \Google\Service\Directory::ADMIN_DIRECTORY_ORGUNIT, ); /* * Provide path to JSON credentials file that was downloaded from Google Developer Console * for Service Account */ protected $authJson; /** * @var \Google\Service\Directory $dir **/ protected $dir; public function __construct() { $authJson = resource_path('jsons/eservices-emails-creds.json'); $this->appName = env("GOOGLE_APP_NAME"); $this->delegatedAdmin = env("GOOGLE_DELEGATED_ADMIN"); /* * Create Google_Client for making API calls with */ $googleClient = new \Google\Client(); $googleClient->setApplicationName($this->appName); $googleClient->useApplicationDefaultCredentials(); $googleClient->setAuthConfig($authJson); $googleClient->setSubject($this->delegatedAdmin); $googleClient->setScopes($this->scopes); $googleClient->setAccessType('offline'); /* * Get an instance of the Directory object for making Directory API related calls */ $this->dir = new \Google\Service\Directory($googleClient); } public function watch(string $url) { $channel = new Channel(); $channel->setId(Str::uuid()->toString()); $channel->setAddress($url); $channel->setType('web_hook'); try { $this->dir->users->watch($channel, [ 'event' => 'delete', ]); } catch (Exception $e) { dd($e); } } } 但它抛出以下异常 { "error": { "code": 400, "message": "Bad Request", "errors": [ { "message": "Bad Request", "domain": "global", "reason": "badRequest" } ] } } 注意 jsons/eservices-emails-creds.json 是从控制台下载的凭证文件,在添加像 $this->dir->users->insert($user) 这样的用户时它可以工作,但创建通知通道失败 尝试在参数数组中添加域: $this->dir->users->watch($channel, [ 'event' => 'delete', 'domain' => 'yourdomain.com' ]); 我将此类用于 $channel 变量: $channel = new Google_Service_Directory_Channel();

回答 1 投票 0

通过 Google Calendar API 发送活动电子邮件通知

我正在使用 calendar.events.insert API 通过 PHP 客户端将事件添加到我的日历中。 该事件与 API 设置的适当值一起正确插入。 然而我也一样...

回答 5 投票 0

Google Meet REST API 资源空间权限被拒绝(或者可能不存在)错误

我刚刚在谷歌云控制台中配置了所有内容,我使用服务帐户作为身份验证方法,并将密钥文件下载为json。但我收到这个错误 “呼叫失败并显示消息:{ &...

回答 1 投票 0

GoogleAnalytics BetaAnalyticsDataClient 获取 INVALID_ARGUMENT:需要日期范围

我尝试从 Google api 获取数据并收到错误 { "message": "需要日期范围。", "code": 3, "status": "INVALID_ARGUMENT", "详细信息&...

回答 1 投票 0

如何从play billing api获取数据

我已经在后端实现了播放计费API,我成功获取了startTime,但lineItems->expiryTime无法获取,不显示任何内容 require_once('autoload.php'); //purchases_prod...

回答 1 投票 0

使用 Google API 时出现身份验证范围不足错误

我设置了 Google SDK 以将 Google API 与应用程序默认凭据一起使用。对于我的本地计算机,创建了一个凭据 json 文件并将其路径设置为 GOOGLE_APPLICATION_CREDENTIALS 作为环境

回答 3 投票 0

获取先决条件检查失败 - 将 gmail api 与服务帐户一起使用时

我正在尝试通过 cronjob 直接从后端获取 gmail 收件箱,没有浏览器或 oauth 的东西。 这是我得到的错误 谷歌\服务\异常:{ “错误”: { “代码”...

回答 2 投票 0

正确存储 Google OAuth 访问令牌

我即将开始使用 Google 的日历 API,我要求访问我的用户的日历。在 php 文档示例中,令牌存储在文件(token.json)中,但在我的情况下,每个用户......

回答 2 投票 0

在 PHP 上创建通用基类时,Google Wallet API 出现无效参数错误

我尝试实现 Google Wallet API 以使用 PHP 创建通用卡通行证,并且我正在使用此处描述的演示代码:https://github.com/google-wallet/rest-samples/blob/main/php/ demo_generic.php 。

回答 2 投票 0

Google Analytics admin api:调用者没有权限

编辑:我只是在我的仪表板分析用户管理中添加电子邮件服务帐户,及其工作 所以我想使用谷歌API通过数据流创建属性。 (使用拉拉维尔) 我有一个是...

回答 1 投票 0

在表中插入多条记录

我目前正在按照官方api源的步骤进行操作。 在项目的当前状态下,我从表中获取信息,更改和插入数据,没有任何错误。 哈...

回答 2 投票 0

composer google/apiclient 警告,如 PHP 警告:未找到“Google_Client”类

我发现了很多类似的其他问题,但没有适合我的问题的解决方案。 我尝试通过 Composer 使用 google/apiclient: 2.14 在我的 xampp 驱动的 Windows 系统上本地没有问题...

回答 1 投票 0

Google OAuth 2 重定向 URI 不匹配

我已经在使用谷歌应用程序进行身份验证。现在,我已将其他 URL 添加到“授权重定向 URI”,但这些 URL 不起作用。旧的工作正常,但当我......

回答 2 投票 0

尝试获取包含许多页面的 Google 文档时出现 503 错误

我遇到了 Google Drive API 的问题。 我在 Ubuntu(版本 22.04.3 LTS)上使用 PHP(版本 8.1.27)和 Symfony 框架(版本 6.4.*)。我合并了最新的 Google API 库(

回答 1 投票 0

如何在PHP中从Google Drive获取文件URL?

我尝试使用 Google Drive API Quickstart.php 并更改了其中的一部分以列出文件 URL。然而它没有用。谁能帮我? 这是我的代码,代码的最后一部分是打印 na...

回答 1 投票 0

Google 客户端无效 JWT:令牌必须是短期令牌

我正在使用 Google 的 php api 客户端。我正在浏览服务帐户的快速入门指南。我完美地遵循了这些步骤(据我所知)。我遇到以下错误: ...

回答 12 投票 0

如何减小Google PHP库的大小?

Google php API 库的大小非常大。我只想向图书馆发送一封电子邮件。我怎样才能减小它的大小?

回答 2 投票 0

Google Analytics API V4 不适用于 GA4 帐户

是否可以通过API V4从新的Google Analytics(GA4)帐户获取数据?它总是返回以下错误消息: {“错误”:{“代码”:403,“消息”:...

回答 1 投票 0

GoogleAPI 已弃用返回类型

我最近在我的一个系统上将 PHP 更新到了 8.1 版本。我还使用“composer update”命令更新了 Composer 版本 2.6.5 2023-10-06 10:11:52(参见输出:) > 作曲家更新 加载...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.