我在检索订阅列表或用户列表以将所有数据与我们自己的业务系统同步时遇到问题。
{
"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>";
由于我未能找到解决问题的方法,因此我在这里询问希望有人知道为什么我会收到 Provisioning API 错误,因为 Provisioning API 已被弃用。