I tried several combinations, but can't come up with something that works. More information about the API I'm asking for can be found here https://developers.google.com/admin-sdk/directory/v1/reference/users/insert . I have a feeling that I just didnβt configure the request correctly. The next bit of code is known to work. I use it to configure a client that can request all users.
client = Google::APIClient.new(:application_name => "myapp", :version => "v0.0.0") client.authorization = Signet::OAuth2::Client.new( :token_credential_uri => 'https://accounts.google.com/o/oauth2/token', :audience => 'https://accounts.google.com/o/oauth2/token', :scope => "https://www.googleapis.com/auth/admin.directory.user", :issuer => issuer, :signing_key => key, :person => user + "@" + domain) client.authorization.fetch_access_token! api = client.discovered_api("admin", "directory_v1")
When I try to use the following code
parameters = Hash.new parameters["password"] = "ThisIsAPassword" parameters["primaryEmail"] = " tstacct2@ " + domain parameters["name"] = {"givenName" => "Test", "familyName" => "Account2"} parameters[:api_method] = api.users.insert response = client.execute(parameters)
I always return the same error "code": 400, "message": "Invalid Given / Family Name: FamilyName"
I have observed several things when considering this particular API. If I print the parameters for both the list and the insert functions, for example,
puts "--- Users List ---" puts api.users.list.parameters puts "--- Users Insert ---" puts api.users.insert.parameters
Only the list actually displays the options
This makes me wonder if the ruby ββclient could not extract the api and therefore would not be able to send the request correctly or if I was just doing something completely wrong.
I would appreciate any idea or direction that could help me on the right track.
Thanks,
James