Search code examples
rubygoogle-apigoogle-appsgoogle-provisioning-apigoogle-api-ruby-client

How do I "discover" Google's Provisioning API?


I'm using the (alpha) Ruby google-api-client to interact with various services for our organization's Google Apps instance.

I'd like to discover the provisioning services API, authenticate a user with a service account, and update their password.

So far...

require 'google/api_client'

class GoogleProvisioningConnection
  def initialize(user_email=nil)
    @client = Google::APIClient.new
    @provisioning = @client.discovered_api('???', 'v2') # what's it called? user?

    key_file_name = 'mykey-privatekey.p12'
    key = Google::APIClient::PKCS12.load_key(key_file_name, 'notasecret')

    asserter = Google::APIClient::JWTAsserter.new(
      '[email protected]',
      '???', # which url allows me access to their user?
    key)

    @client.authorization = asserter.authorize(user_email)
  end

end

Which string is used with @client.discovered_api to get at the provisioning API?
And when the JWT asserter is used, which service url should be requested?
Thanks


Solution

  • The Provisioning API uses the old gdata protocol. It won't work with the new discovery based libraries.

    You should use the GData Ruby Library.