Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 9.04 KB

File metadata and controls

99 lines (70 loc) · 9.04 KB

Indexing.Shortcuts

Overview

Available Operations

bulk_index

Replaces all the currently indexed shortcuts using paginated batch API calls. Note that this endpoint is used for indexing shortcuts not hosted by Glean. If you want to upload shortcuts that would be hosted by Glean, please use the /uploadshortcuts endpoint. For information on what you can do with Golinks, which are Glean-hosted shortcuts, please refer to this page.

Example Usage

from glean.api_client import Glean
import os


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

    glean.indexing.shortcuts.bulk_index(upload_id="<id>", shortcuts=[
        {
            "input_alias": "<value>",
            "destination_url": "https://plump-tune-up.biz/",
            "created_by": "<value>",
            "intermediate_url": "https://lean-sightseeing.net",
        },
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this bulk upload instance
shortcuts List[models.ExternalShortcut] ✔️ Batch of shortcuts 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 */*

upload

Creates glean shortcuts for uploaded shortcuts info. Glean would host the shortcuts, and they can be managed in the knowledge tab once uploaded.

Example Usage

from glean.api_client import Glean
import os


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

    glean.indexing.shortcuts.upload(upload_id="<id>", shortcuts=[
        {
            "input_alias": "<value>",
            "destination_url": "https://majestic-pharmacopoeia.info/",
            "created_by": "<value>",
        },
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this bulk upload instance
shortcuts List[models.IndexingShortcut] ✔️ Batch of shortcuts 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 */*