0

I'm using the google admin api class to check for organization units. First level works, but second level fails. I've tried putting it in single quotes as per other posts, but still won't find it, and I get Yes No everytime. This seems to have started happening about two months ago. Anything that would have changed?

// This returns all of them
//$units = $google_client->getOrgUnits('my_customer', ["type" => "ALL"]);

if ($google_client->OrgUnitExists('my_customer', "A")) {
    echo "Yes\r\n";
    if ($google_client->OrgUnitExists('my_customer', "A/B")) {
      echo "Yes\r\n";
    }
    else {
      echo "No\r\n";
    }
  }
  else {
    echo "No\r\n";
  }
Alex
  • 1
  • Are you getting any errors along with your request? – ale13 Jul 21 '21 at 13:25
  • Just Invalid OU. I've worked around it by getting a list of all ou's which does return all of them, and substituting A/B for its orgUnitId – Alex Jul 22 '21 at 14:20

1 Answers1

0

According to the documenation for the orgunits.get request:

orgUnitPath > The full path of the organizational unit or its unique ID.

From the description of your question it looks like you are not supplying an accurate path to the request, hence the "Yes No" response.

Instead, you can also pass the id of the organization unit.

Reference

ale13
  • 5,679
  • 3
  • 10
  • 25