Google Directory Read

Google Directory Read

In this article

 

Overview

You can use this Snap to read the data of the Users, User photos, Groups and Org units from the Google Directory.

  • Verify that you have the correct Application scope defined for your account. See Google Directory Application Scope for more information.

  • Access tokens for Google Directory accounts expire in one hour.

google-directory-read-overview.png

 

Snap Type

The Google Directory Read Snap is a Write-type Snap.

Prerequisites

  • A valid account with the required permissions.

Support for Ultra Pipelines

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

 

  • Min: 0

  • Max: 1

  • File Reader followed by any File parser followed by Structure.

  • Mapper

Resource type and Filter attributes(Filter keys, Filter values)

Output

Document

 

  • Min: 1

  • Max: 1

  • Mapper

  • Any File Formatter followed by File Writer.

The data for the resource type provided.

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:

  • Stop Pipeline Execution: Stops the current pipeline execution if the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the remaining records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap Settings

  • Asterisk ( * ): Indicates a mandatory field.

  • Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon ( ): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon ( ): Indicates that you can add fields in the fieldset.

  • Remove icon ( ): Indicates that you can remove fields from the fieldset.

  • Upload icon ( ): Indicates that you can upload files.

Field Name

Field Type

Description

Label*

 

 

String

Specify a unique name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

Default ValueGoogle Directory Read
ExampleGoogle Directory Read

Resource

 

Dropdown

Required. The type of resource to be created. The options available include:

  • user - userKey required if calling the Users Get API.

  • userPhoto - userKey required.

  • orgunit - customerID and GetOrgUnitPath or ListOrgUnitPath must be specified as Filter attributes.

  • group - groupKey required if calling the Groups Get API.

Default value: user
Example: group 

Filter Attributes

Use this field set to list the attributes to return the search results.

Filter Keys

 

String/Expression/Suggestion

The suggested filter attributes based on the provided Resource Type selected.

Default value: user
Example: domain

Filter values

 

String/Expression/Suggestion

The corresponding values of the suggested filter key to read the resource.

Default value: user
Example: group

On empty result

 

Dropdown

Specify or select the Snap behavior when no matching filter value is found. The available options are:

Ignore: Select this option if you do not require an output document.

Error: Select this option if you want to send an error document to the error view.

Output: Select this option if you want an empty output document.

  • If you do not choose any of the options for On empty result (an empty space), the behavior of Snap for empty results remains consistent with its previous state.

  • If the resource type is userPhoto, the On empty result property value is not required.

Default value: None
Examples: Ignore

Dropdown list

  

Supported Filter Attributes by Resource

User

  • userKey - Required for Users Get API. Set the expression toggle (=) off and enter the userKey.

  • domain - Optional. Set the expression toggle (=) off and enter the domain.

  • showDeleted - Optional. Set the expression toggle (=) off and enter true | false.

  • fields - Optional. Set the expression toggle (=) off and list the fields to return, separated by a comma. See the API documentation referenced at the bottom of the page for the complete list of fields.

  • query -  Optional. Set the expression toggle (=) off and enter the query without quotation marks.

  • maxResults - Optional. Set the expression toggle (=) off and enter an integer (1 to 500, inclusive).

  • customer -  Set the expression toggle (=) off and enter the customerID. If you are an account administrator, you can use the my_customer alias with the expression toggle off.

  • projection - Optional. Set the expression toggle (=) off and enter custom or full in the Filter value field to retrieve the schema field.

  • customFieldMask - Optional. Set the expression toggle (=) off and list the custom fields to retrieve custom schema fields.

User.Photo

  • userKey - Required. Set the expression toggle (=) off and enter the userKey.

 

OrgUnit

  • customerID - Required. Set the expression toggle (=) off and enter the customerID.

  • GetOrgUnitPath - Required to call the OrgUnits Get API. Set the expression toggle (=) off and list the name of the org without a preceding slash (that is, TestOrg instead of /TestOrg).

  • ListOrgUnitPath - Required to call the OrgUnits List API. Set the expression toggle (=) off and list the name of the org without a preceding slash (that is, TestOrg instead of /TestOrg).

  • type - An optional parameter from the OrgUnits List API. Set the expression toggle (=) off and enter all | children.

  • fields - An optional parameter for either the OrgUnits Get API or the OrgUnits List API. Set the expression toggle (=) off and list the fields to return, separated by a comma.  See the API documentation referenced at the bottom of the page for the complete list of fields.

Group

  • groupKey - Required for Groups Get API. Set the expression toggle (=) off and enter the groupKey.

  • customer - Set the expression toggle (=) off and enter the customerID. If you are an account administrator, you can use the my_customer alias with the expression toggle off.

  • domain -  Optional. Set the expression toggle (=) off and enter the domain.

  • maxResults - Optional. Set the expression toggle (=) off and enter an integer.

  • fields -  Optional. Set the expression toggle (=) off and list the fields to return, separated by a comma. See the API documentation referenced at the bottom of the page for the complete list of fields.

  • userKey - Optional. Set the expression toggle (=) off and enter the userKey. Returns all groups to which this user belongs.

Troubleshooting

Error

Reason

Resolution

Failure: IO error occurred

400 Bad Request GET https://admin.googleapis.com/admin/directory/v1/customer/my_customer/orgunits { "code": 400, "errors": [ { "domain": "global", "message": "Invalid Customer Id", "reason": "invalid" } ], "message": "Invalid Customer Id" },

Provide the customerID as Google Service Account is not associated with any customer. Ensure that the scope is correctly defined for the action/resource being executed.

directory/v1/groups?customer=my_customer { "code": 404, "errors": [ { "domain": "global", "message": "Domain not found.", "reason": "notFound" } ], "message": "Domain not found." }

 

Either provide customer or domain information as Google Service Account is not associated with any customer or domain.

Examples

Perform End-to-End Operations in Google Directory.

The following tables provides sample:

Resource

Filter key

Filter value

Result

userPhoto

userkey

(expression toggle (=) off) user@example.com

Returns the resource data for the user's photo.

user

[None]

[None]

Returns all users.

user

domain

(expression toggle (=) off) example.com

Returns all users within the specified domain.

user

showDeleted

(expression toggle (=) off) true

Returns deleted users.

user

customer

(expression toggle (=) off)  my_customer

Returns all users for the customer ID if the account is an account administrator.

user

fields

(expression toggle (=) off)  users(aliases,name,primaryEmail)

Returns the name, primary email and email aliases for all users.

user

query

(expression toggle (=) off) isAdmin=true

Returns all admins.

user

query

(expression toggle (=) off) givenName:Tim*

Returns all users whose givenName starts with Tim.

orgunit

fields

(expression toggle (=) off)  kind,name,orgUnitPath

Returns kind,name,orgUnitPath fields of the orgunits.

 

Related links: