Bad request error with ruby google-api-client when querying Google Admin Directory API -
i using version 0.6.4 of google-api-client ruby gem query google admin directory api.
here session in ruby console:
require 'rubygems' require 'google/api_client' service_account_client_id = "some_string.apps.googleusercontent.com" service_account_email = "some_string@developer.gserviceaccount.com" service_account_pkcs12_file_path = "/path/to/privatekey.p12" key = google::apiclient::keyutils.load_from_pkcs12(service_account_pkcs12_file_path, 'notasecret') asserter = google::apiclient::jwtasserter.new(service_account_email, "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly", key) client = google::apiclient.new client.authorization = asserter.authorize dir_api = client.discovered_api('admin', 'directory_v1') resp = client.execute(:api_method => dir_api.chromeosdevices.list, :parameters => {'customerid'=>service_account_client_id}) resp.body => "{\n \"error\": {\n \"errors\": [\n {\n \"domain\": \"global\",\n \"reason\": \"badrequest\",\n \"message\": \"bad request\"\n }\n ],\n \"code\": 400,\n \"message\": \"bad request\"\n }\n}\n"
i missing obvious here unclear error response missing in request. appreciate help/pointers in right direction.
thanks.
i got similar response in c# program, listing users in domain.
i still haven't resolved far managed same error message in apis explorer https://developers.google.com/apis-explorer/#p/admin/directory_v1/ when trying same request there , omitting value domain.
that led me believe somehow needed add domain request in c#-code , trial , error think found how in c#.
but suggestion try api request in apis explorer , se if same error message there not submitting value domain, think that's error-message means.
Comments
Post a Comment