Google api 谷歌应用程序API-获取订阅或用户列表
我检索订阅列表或用户列表时遇到问题,无法将所有数据与我们自己的业务系统同步Google api 谷歌应用程序API-获取订阅或用户列表,google-api,google-reseller-api,Google Api,Google Reseller Api,我检索订阅列表或用户列表时遇到问题,无法将所有数据与我们自己的业务系统同步 { "error": { "errors": [ { "domain": "global", "reason": "conditionNotMet", "message": "Provisioning API is disabled for your domain. Please enable it in your Google Apps Control Panel.", "l
{
"error": {
"errors": [
{
"domain": "global",
"reason": "conditionNotMet",
"message": "Provisioning API is disabled for your domain. Please enable it in your Google Apps Control Panel.",
"locationType": "header",
"location": "If-Match"
}
],
"code": 412,
"message": "Provisioning API is disabled for your domain. Please enable it in your Google Apps Control Panel."
}
}
我使用的是google PHP库,这基本上就是我使用的代码,这是google示例库中的一个稍微修改过的示例
$client->setScopes(array(
'https://www.googleapis.com/auth/apps.order', // As required by the google api docs for /subscription
));
/**
* Google's own example code
*/
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['access_token'] = $client->getAccessToken();
$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
}
if ($client->getAccessToken()) {
$url = 'https://www.googleapis.com/apps/reseller/v1';
//$url = 'https://www.googleapis.com/apps/reseller/v1sandbox/'; // sandbox mode overwrite
$req = new Google_HttpRequest($url .'/subscriptions', 'GET');
$resp = $client::getIo()->authenticatedRequest($req);
print "<h1>Subscriptions</h1>: <pre>" . $resp->getResponseBody() . "</pre>";
$client->setscope(阵列)(
'https://www.googleapis.com/auth/apps.order“,//根据/订阅的google api文档的要求
));
/**
*谷歌自己的示例代码
*/
如果(isset($_GET['code'])){
$client->authenticate();
$\会话['access\u token']=$client->getAccessToken();
$redirect='http://'.$\u服务器['http\u主机].$\u服务器['PHP\u SELF'];
标题('Location:'.filter_var($redirect,filter_SANITIZE_URL));
}
如果(isset($_会话['access_token'])){
$client->setAccessToken($_会话['access_token']);
}
如果($client->getAccessToken()){
$url='1https://www.googleapis.com/apps/reseller/v1';
//$url='1https://www.googleapis.com/apps/reseller/v1sandbox/“;//沙盒模式覆盖
$req=newgoogle_HttpRequest($url.'/subscriptions,'GET');
$resp=$client::getIo()->authenticatedRequest($req);
打印“订阅:”..resp->getResponseBody();
由于我无法找到问题的解决方案,我在这里询问,希望有人知道我为什么会遇到设置API错误,因为设置API已被弃用。从控制面板启用API访问,它在错误描述中 控制面板->otehr控制->安全->api参考->启用api访问 我正在尝试做同样的事情,但权限不足…:()