0

I am having trouble retrieving a list of subscriptions, or a list of users, to sync all the data with our own business system.

{
 "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."
 }
}

I am using the google PHP library, and this is basically the code I am using, which is a slightly modified example from googles example library.

$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>";

Since I'm failing at finding a solution to my problem I'm asking here hoping someone might know why I am getting a Provisioning API error, as the Provisioning API has been deprecated.

user2215771
  • 239
  • 3
  • 12

1 Answers1

0

Enable API access from the control panel, it's in the error description.

Control panel -> otehr controls -> security -> api reference -> enable api access.

I'm trying to do the same thing and get an insufficient permissions... :(

Luca
  • 11
  • 4