Skip to content

Latest commit

 

History

History
414 lines (282 loc) · 30.9 KB

File metadata and controls

414 lines (282 loc) · 30.9 KB

Indexing.People

Overview

Available Operations

debug

Gives various information that would help in debugging related to a particular user. Currently in beta, might undergo breaking changes without prior notice.

Tip: Refer to the Troubleshooting tutorial for more information.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    res = glean.indexing.people.debug(datasource="<value>", email="u1@foo.com")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
datasource str ✔️ The datasource to which the user belongs
email str ✔️ Email ID of the user to get the status for u1@foo.com
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DebugUserResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

count

Fetches user count for the specified custom datasource.

Tip: Use /debug/{datasource}/status for richer information.

⚠️ DEPRECATED: Deprecated on 2026-02-03, removal scheduled for 2026-10-15: Endpoint is deprecated.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    res = glean.indexing.people.count(datasource="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
datasource str ✔️ Datasource name for which user count is needed.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetUserCountResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

index

Adds an employee or replaces the existing information about an employee.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.index(employee={
        "email": "Jerrold_Hermann@hotmail.com",
        "department": "<value>",
        "datasource_profiles": [
            {
                "datasource": "github",
                "handle": "<value>",
            },
        ],
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
employee models.EmployeeInfoDefinition ✔️ Describes employee info
version Optional[int] Version number for the employee object. If absent or 0 then no version checks are done
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

bulk_index

Replaces all the currently indexed employees using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints.

⚠️ DEPRECATED: Deprecated on 2026-02-03, removal scheduled for 2026-10-15: Endpoint is deprecated.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.bulk_index(upload_id="<id>", employees=[
        {
            "email": "Robin.Stoltenberg@yahoo.com",
            "department": "<value>",
            "datasource_profiles": [
                {
                    "datasource": "github",
                    "handle": "<value>",
                },
            ],
        },
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this bulk upload instance
employees List[models.EmployeeInfoDefinition] ✔️ Batch of employee information
is_first_page Optional[bool] true if this is the first page of the upload. Defaults to false
is_last_page Optional[bool] true if this is the last page of the upload. Defaults to false
force_restart_upload Optional[bool] Flag to discard previous upload attempts and start from scratch. Must be specified with isFirstPage=true
disable_stale_data_deletion_check Optional[bool] True if older employee data needs to be force deleted after the upload completes. Defaults to older data being deleted only if the percentage of data being deleted is less than 20%. This must only be set when isLastPage = true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

process_all_employees_and_teams

Schedules the immediate processing of employees and teams uploaded through the indexing API. By default all uploaded people data will be processed asynchronously but this API can be used to schedule its processing on demand.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.process_all_employees_and_teams()

    # Use the SDK ...

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

delete

Delete an employee. Silently succeeds if employee is not present.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.delete(employee_email="<value>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
employee_email str ✔️ The deleted employee's email
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

index_team

Adds a team or updates information about a team

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.index_team(team={
        "id": "<id>",
        "name": "<value>",
        "datasource_profiles": [
            {
                "datasource": "github",
                "handle": "<value>",
            },
        ],
        "members": [
            {
                "email": "Valerie9@gmail.com",
            },
        ],
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
team models.TeamInfoDefinition ✔️ Information about an employee's team
version Optional[int] Version number for the team object. If absent or 0 then no version checks are done
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

delete_team

Delete a team based on provided id.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.delete_team(id="<id>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
id str ✔️ The deleted team's id
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

bulk_index_teams

Replaces all the currently indexed teams using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.people.bulk_index_teams(upload_id="<id>", teams=[
        {
            "id": "<id>",
            "name": "<value>",
            "datasource_profiles": [
                {
                    "datasource": "github",
                    "handle": "<value>",
                },
            ],
            "members": [
                {
                    "email": "Nina_Erdman16@gmail.com",
                },
            ],
        },
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this bulk upload instance
teams List[models.TeamInfoDefinition] ✔️ Batch of team information
is_first_page Optional[bool] true if this is the first page of the upload. Defaults to false
is_last_page Optional[bool] true if this is the last page of the upload. Defaults to false
force_restart_upload Optional[bool] Flag to discard previous upload attempts and start from scratch. Must be specified with isFirstPage=true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*