我无法检索订阅列表或用户列表,以便将所有数据与我们自己的业务系统同步。
{
"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库,这基本上就是我正在使用的代码,这是googles示例库中稍微修改过的示例。
$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>";
由于我未能找到问题的解决方案,我在这里问我希望有人可能知道我为什么会收到Provisioning API错误,因为Provisioning API已被弃用。
答案 0 :(得分:0)
从控制面板启用API访问,它位于错误说明中。
控制面板 - &gt; otehr控制 - &gt;安全 - &gt; api reference - &gt;启用api访问。
我正在尝试做同样的事情而获得的权限不足...... :(