barryhennessy / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

Google_GroupsServiceResource missing alt=json in get method #302

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 
'google-api-php-client/src/contrib/Google_GroupssettingsService.php';

// Set your cached access token. Remember to replace $_SESSION with a
// real database or memcached.
session_start();

$client = new Google_Client();
$client->setApplicationName('Groupssettings PHP Starter Application');
// Visit https://code.google.com/apis/console?api=plus to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('insert_your_oauth2_client_id');
$client->setClientSecret('insert_your_oauth2_client_secret');
$client->setRedirectUri('insert_your_oauth2_redirect_uri');
$client->setDeveloperKey('insert_your_simple_api_key');
$groupssettingsService = new Google_GroupssettingsService($client);
$groups = $groupssettingsService->groups;

if (isset($_GET['code'])) {
  $client->authenticate();
  $_SESSION['token'] = $client->getAccessToken();
  $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
  header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}

if (isset($_SESSION['token'])) {
  $client->setAccessToken($_SESSION['token']);
}

if ($client->getAccessToken()) {

  $info=$groups->get("{groupUniqueId}");
  var_dump($info);

  // We're not done yet. Remember to update the cached access token.
  // Remember to replace $_SESSION with a real database or memcached.
  $_SESSION['token'] = $client->getAccessToken();
} else {
  $authUrl = $client->createAuthUrl();
  print "<a href='$authUrl'>Connect Me!</a>";
}

What is the expected output? What do you see instead?

I am getting an xml response which appears to be the default instead of the 
expect json response.

What version of the product are you using? On what operating system?

version 0.6.2 on Apache 2.2 / PHP 5.3.16

Please provide any additional information below.

Add the alt=json parameter to the Google_GroupsServiceResource get method like 
shown below:

    /**
     * Gets one resource by id. (groups.get)
     *
     * @param string $groupUniqueId The resource ID
     * @param array $optParams Optional parameters.
     * @return Google_Groups
     */
    public function get($groupUniqueId, $optParams = array()) {
      $params = array('groupUniqueId' => $groupUniqueId,
                      'alt' => 'json');

Original issue reported on code.google.com by wdouglas...@gmail.com on 12 Apr 2013 at 2:32

GoogleCodeExporter commented 8 years ago

Original comment by ianbar...@google.com on 15 Apr 2013 at 9:33

GoogleCodeExporter commented 8 years ago
This issue tracker is now closing. Development on the Google PHP client library 
moved to GitHub with the release of the 1.0.0-alpha, and now the 1.0 branch has 
reached beta status there will be no further releases of the 0.6 branch of the 
library. 

Please take a look at the latest version on 
https://github.com/google/google-api-php-client

For information on migrating, please take a look at this guide: 
https://developers.google.com/api-client-library/php/guide/migration

For general library support please ask a question on StackOverflow: 
http://stackoverflow.com/questions/tagged/google-api-php-client

If you are looking for support with a specific API, please contact the team 
working with that API via StackOverflow or their preferred support mechanism. 

If your issue still exists with the new version of the library, please raise a 
bug in the GitHub issue tracker with a minimal code sample. 

Thanks!

Original comment by ianbar...@google.com on 22 Jan 2014 at 4:53