Gwin,

I managed to retrieve the feeds from the Admin Audit API, so you are
probably missing some steps.
First of all, did you create a Client ID in your API console? This step will
provide you with Client ID and Client Secret to be used during the
authentication process.

I understand you are also trying to use the Google Data APIs Python Client
Library for both retrieving the Customer ID (which is provided by a GData
API) and sending requests to the new Admin Audit API.
The latter API is supported by our new Python client library:

http://code.google.com/p/google-api-python-client

Assuming you are able to get your Client ID, Client Secret, Consumer ID and
API Key, you can use the following Python code (edited from the Buzz sample)
with the new client library to send a request to the Admin Audit API:


#!/usr/bin/python2.4

import httplib2
import sys

from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run

CLIENT_ID = 'your client id'
CLIENT_SECRET = 'your client secret'
CONSUMER_ID = 'your consumer id'
API_KEY = 'you api key'


# Set up a Flow object to be used if we need to authenticate. This
# sample uses OAuth 2.0, and we set up the OAuth2WebServerFlow with
# the information it needs to authenticate. Note that it is called
# the Web Server Flo w, but it can also handle the flow for native
# applications <http://code.google.com/apis/accounts/docs/OAuth2.html#IA>
# The client_id client_secret are copied from the API Access tab on
# the Google APIs Console <http://code.google.com/apis/console>. When
# creating credentials for this application be sure to choose an Application
# type of "Installed application".
flow = OAuth2WebServerFlow(
  client_id=CLIENT_ID,
  client_secret=CLIENT_SECRET,
  scope='https://www.googleapis.com/auth/apps/reporting/audit.readonly',
  user_agent='audit-cmdline-sample/1.0')

# If the Credentials don't exist or are invalid run through the native
client
# flow. The Storage object will ensure that if successful the good
# Credentials will get written back to a file.
storage = Storage('credentials.dat')
credentials = storage.get()
if credentials is None or credentials.invalid:
  credentials = run(flow, storage)

# Create an httplib2.Http object to handle our HTTP requests and authorize
it
# with our credentials.
http = httplib2.Http()
http = credentials.authorize(http)
resp, content = http.request('
https://www.googleapis.com/apps/reporting/audit/v1/%s/207535951991?key=%s' %
(CONSUMER_ID, API_KEY))

print content


Hope it helps
Claudio

On Wed, Jun 8, 2011 at 10:16 PM, Gwyn Howell <[email protected]>wrote:

> i have the same concerns regarding the api key, as i am going to have to
> get my customers to create they're own api keys (and possibly set up
> billing) which is going to be a pain. regardless, i just need to get it
> working now and worry about that later.
>
> please update this thread with any breakthroughs!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Apps Domain Information and Management APIs" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-apps-mgmt-apis/-/djlrR0NXYy1pdklK.
>
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Apps Domain Information and Management APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Reply via email to