You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate user accounts with the API. I've run the sample code that does "list users" and get the first 10 users in my domain. When I try to do an insert with a test user object, I get back the "Invalid Given/Family Name". I can't figure out what I'm doing wrong here....
# Initialize the API
service = Google::Apis::AdminDirectoryV1::DirectoryService.new
service.client_options.application_name = APPLICATION_NAME
service.authorization = authorize
# List the first 10 users in the domain
user_object = {
'primaryEmail' => 'help@here.edu',
'name' => {
'givenName' => 'Test',
'familyName' => 'User'
},
'password' => initial_password,
'changePasswordAtNextLogin' => true
}
response = service.insert_user(user_object)
puts response
exit
The error I get is this...
$ bundle exec ./prep_account.rb
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/http_command.rb:202:in `check_status': invalid: Invalid Given/Family Name: FamilyName (Google::Apis::ClientError)
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/api_command.rb:103:in `check_status'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/http_command.rb:170:in `process_response'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/http_command.rb:275:in `execute_once'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/http_command.rb:107:in `block (2 levels) in execute'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/http_command.rb:104:in `block in execute'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/http_command.rb:96:in `execute'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/lib/google/apis/core/base_service.rb:267:in `execute_or_queue_command'
from /Users/matt/.chefdk/gem/ruby/2.1.0/gems/google-api-client-0.9/generated/google/apis/admin_directory_v1/service.rb:3108:in `insert_user'
from ./prep_account.rb:62:in `<main>'
The text was updated successfully, but these errors were encountered:
The ruby client uses snake case (as per ruby convention) in the generated interfaces.
# Initialize the APIservice=Google::Apis::AdminDirectoryV1::DirectoryService.newservice.client_options.application_name=APPLICATION_NAMEservice.authorization=authorize# List the first 10 users in the domainuser_object={'primary_email'=>'help@here.edu','name'=>{'given_name'=>'Test','family_name'=>'User'},'password'=>initial_password,'change_password_at_next_login'=>true}response=service.insert_user(user_object)putsresponseexit
I'm trying to generate user accounts with the API. I've run the sample code that does "list users" and get the first 10 users in my domain. When I try to do an insert with a test user object, I get back the "Invalid Given/Family Name". I can't figure out what I'm doing wrong here....
The error I get is this...
The text was updated successfully, but these errors were encountered: