Get User

Table of Contents

Overview

The zoho.directory.getUser task is used to fetch a user with their ID within an organization.

Syntax

response = zoho.directory.getUser(<orgID>, <userID>, <queryParams>, <connectionName>);

Scope

ZohoDirectory.Users.READ

where:

ParameterDescriptionData type
responseis the variable that will hold the details of the users fetched from the organization.KEY-VALUE
<orgID>is the ID of the organization from which the users need to be fetched.NUMBER
<queryParams>

is the variable that holds the query parameters.

  • Include  
KEY-VALUE
<connectionName>is the name of the Zoho Directory connection.TEXT
<userID>is the ID of the user that needs to be fetched.NUMBER

Supported Includes:

ParametersDescription
addressIncluding address in the fetch call will return the user's full address along with other details in the response.
custom_fieldsUsed to retrieve custom field data as part of the user's details.
user.locationUsed to fetch user's location details in the response.
emailsIncluding emails will provide information, such as primary and secondary email addresses of the user.
user.extendedinfoUse extendedinfo to fetch additional information of the user like date of birth, designation, and date of joining.
user.departmentinfoInclude departmentinfo to retrieve department details as part of the user's information.

Example 1

response = zoho.directory.getUser(72XXXXXXX, 1510XXXXXXXX, Map(), "zoho_directory_connection");

where:

response
This is the KEY-VALUEresponse returned by Zoho Directory.
72XXXXXXX
This is the NUMBERthat represents the organization ID of Zoho Directory account from which the user needs to be fetched.
queryParams
This is the KEY-VALUEvariable that holds the query parameters.
zoho_directory_connection
This is the TEXTthat represents the link name of the connection.
1510XXXXXXXX
This is the NUMBERthat represents the user ID that needs to be fetched.

Example 2

queryParams = Map();
include = [];
include.add("address");
include.add("custom_fields");
include.add("emails");
include.add("user.location");
include.add("user.extendedinfo");
queryParams.put("include", include);
response = zoho.directory.getUser(72XXXXXXX, 1510XXXXXXXX, queryParams, "zoho_directory_connection")

where:

"address", "custom_fields", "emails", "user.location",  and "user.extendedinfo".
is the additional information included to get along with the user. Only these are supported user information that can be included.

Response format

{
    "status_code": 200,
    "users": {
        "address": [
            {
                "address_type": 1,
                "city": “****”,
                "country": “**”,
                "country_display_name": “*****”,
                "extension": “2***”,
                "mobile": “99*******”,
                "phone": “89*******”,
                "postal_code": “66*****”,
                "seating_location": “O****”,
                "state": “******”,
                "street_address": “***”
            }
        ],
        "country_code": "gb",
        "customFields": [
            {
                "field_id": "79***********",
                "field_name": "BLOOD-GROUP",
                "field_value": “**”
            },
            {
                "field_id": "79***********",
                "field_name": "Height",
                "field_value": ***
            }
        ],
        "designation_id": "71******”,
        "display_name": “ki******”,
        "emails": [
            {
                "email_id": “ki******@*******.***”,
                "is_primary": true,
                "is_verified": true
            }
        ],
        "employee_id": “3****”,
        "first_name": “Ki******",
        "full_name": "ki******",
        "gender": "M",
        "is_active": true,
        "is_admin": false,
        "is_confirmed": true,
        "is_invited": false,
        "is_joined": false,
        "language_code": "en-us",
        "last_name": "",
        "reportingTo": {
            "emails": [
                {
                    "email_id": "na******@*******.***",
                    "is_primary": true,
                    "is_verified": true
                }
            ],
            "user_id": "79***********",
            "zuid": "77*******"
        },
        "timezone": "Asia/Kolkata",
        "user_id": "79**************”,
        "user_type": "confirmed",
        "zuid": "77*******"
},
 
 
    "resource_name": "users"
}