0

I'm trying to consume this API:https://developers.google.com/admin-sdk/directory/v1/reference/resources/buildings/list?authuser=2

scopes are ok, and also I can get correctly the Token

When I try to list the buildings, this error appears, as API Response body:

  [Google_Service_Exception (404)]    
  {                                   
   "error": {                         
    "errors": [                       
     {                                
      "domain": "global",             
      "reason": "notFound",           
      "message": "Domain not found."  
     }                                
    ],                                
    "code": 404,                      
    "message": "Domain not found."    
   }                                  
  } 

What can it be?

1 Answers1

0

What did you enter on "customer" usually the "my_customer" alias works instead of the domain, it should return something like this with a 200ok.

{
 "kind": "admin#directory#resources#buildings#buildingsList",
 "etag": "\"zPBZh0CqI7H8js2356iu34gfr/vp6Pfh5j7RvsFk64fdf3eyIC8\"",
 "buildings": []
}

Keep in mind that the Admin SDK must be used with a Super Admin of a G Suite account, it cannot be used with consumer gmail accounts. The "Domain not found." is generated when the Admin SDK is executed with a gmail account, check what account you are logged in.

Sometimes there is a problem when you login with different accounts to the browser window. In case of chrome you can have multiple profiles https://support.google.com/chrome/answer/2364824?co=GENIE.Platform%3DDesktop&hl=en that way it will not share cookies and cache since that is usually the problem when using the "Try this API" from Google APIs.

I hope this helps. Greetings.

Mario R.
  • 659
  • 5
  • 11
  • Thanks for the answer. I'm consuming the API with the google-admin-sdk in PHP, so I'm not logged in any web browser. I created a Service account and I'm using the json with the credentials downloaded directly from console.developers.google.com In fact, I can retrieve "correctly" a token (it means authentication works I guess), but then for any endpoint I'm calling, that error happens – Inmarelibero Jun 12 '19 at 07:17