### UiPath SDK: Manage Tasks Source: https://uipath.github.io/uipath-typescript/getting-started_q= Code examples demonstrating how to interact with tasks using the UiPath SDK. This includes fetching all available tasks and assigning a specific task to a user. ```typescript // Get all tasks const tasks = await sdk.tasks.getAll(); // Assign task to user await tasks[0].assign({ userNameOrEmail: 'john@example.com' }); ``` -------------------------------- ### Install UiPath TypeScript SDK using npm, yarn, or pnpm Source: https://uipath.github.io/uipath-typescript/getting-started_q= Instructions for installing the UiPath TypeScript SDK using different package managers. Ensure you have Node.js and npm (or yarn/pnpm) installed. ```bash npm install @uipath/uipath-typescript ``` ```bash yarn add @uipath/uipath-typescript ``` ```bash pnpm add @uipath/uipath-typescript ``` -------------------------------- ### Project Setup for UiPath TypeScript SDK Source: https://uipath.github.io/uipath-typescript/llms-full-content Sets up a new project for using the UiPath TypeScript SDK. This includes creating a project directory, initializing npm, installing TypeScript and related types, and initializing the TypeScript compiler. ```bash mkdir my-uipath-project && cd my-uipath-project npm init -y npm install typescript @types/node ts-node --save-dev npx tsc --init npm install @uipath/uipath-typescript ``` -------------------------------- ### Create a new TypeScript or JavaScript project Source: https://uipath.github.io/uipath-typescript/getting-started Initializes a new project directory for either a TypeScript or JavaScript project. This is a foundational step before integrating the SDK. ```bash mkdir my-typescript-project ``` ```bash mkdir my-javascript-project ``` -------------------------------- ### UiPath SDK: Work with Entities Source: https://uipath.github.io/uipath-typescript/getting-started_q= Examples for managing entities within the UiPath SDK. This covers retrieving entity metadata, fetching records associated with an entity, and inserting new data. ```typescript // Get entity metadata const entity = await sdk.entities.getById('entity-id'); // Fetch records const customers = await entity.getRecords({ pageSize: 10 }); // Insert new data await entity.insert([ { name: 'John Doe', email: 'john@example.com', status: 'Active' } ]); ``` -------------------------------- ### Pagination Usage Examples Source: https://uipath.github.io/uipath-typescript/llms-full-content Provides practical examples of how to use the pagination options to fetch data in pages. ```APIDOC ## Pagination Usage Examples ### Basic Pagination #### Description This example demonstrates how to fetch the first page of assets with a specified page size and how to access the returned pagination information. #### Code Example ```typescript // Assuming 'sdk' is an initialized instance of the UiPath SDK // Get the first page with 10 items const firstPage = await sdk.assets.getAll({ pageSize: 10 }); console.log(`Got ${firstPage.items.length} items`); console.log(`Total items: ${firstPage.totalCount}`); console.log(`Has next page: ${firstPage.hasNextPage}`); // To fetch the next page, you would use the nextCursor: // if (firstPage.hasNextPage && firstPage.nextCursor) { // const nextPage = await sdk.assets.getAll({ cursor: firstPage.nextCursor }); // } ``` ``` -------------------------------- ### POST /processes/start Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel_q= Starts a process with the specified configuration. ```APIDOC ## POST /processes/start ### Description Starts a process with the specified configuration. ### Method POST ### Endpoint /processes/start ### Parameters #### Query Parameters - **folderId** (number) - Required - Required folder ID - **options** (RequestOptions) - Optional - Optional request options #### Request Body - **request** (ProcessStartRequest) - Required - Process start configuration - **processKey** (string) - Optional - The key of the process to start. - **processName** (string) - Optional - The name of the process to start. - **inputArgs** (object) - Optional - Input arguments for the process. ### Request Example ```javascript // Start a process by process key const process = await sdk.processes.start({ processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }, ); // folderId is required // Start a process by name with specific robots const process = await sdk.processes.start({ processName: "MyProcess" }, ); // folderId is required ``` ### Response #### Success Response (200) - **[]** (ProcessStartResponse[]) - Array of started process instances. #### Response Example ```json [ { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Running" } ] ``` ``` -------------------------------- ### POST /processes/start Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel Starts a process with the specified configuration. ```APIDOC ## POST /processes/start ### Description Starts a process with the specified configuration. ### Method POST ### Endpoint /processes/start ### Parameters #### Request Body - **request** (ProcessStartRequest) - Required - Process start configuration - **folderId** (number) - Required - Required folder ID #### Query Parameters - **options** (RequestOptions) - Optional - Optional request options ### Request Example ```javascript // Start a process by process key const process = await sdk.processes.start({ processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }, ); // folderId is required // Start a process by name with specific robots const process = await sdk.processes.start({ processName: "MyProcess" }, ); // folderId is required ``` ### Response #### Success Response (200) - **[]** (ProcessStartResponse[]) - Array of started process instances #### Response Example ```json [ { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Running" } ] ``` ``` -------------------------------- ### Install Dependencies and Build Project with npm Source: https://uipath.github.io/uipath-typescript/CONTRIBUTING_q= This snippet demonstrates the basic commands for setting up the development environment for the UiPath TypeScript SDK. It includes cloning the repository, installing project dependencies using npm, and building the project. ```bash git clone https://github.com/your-username/uipath-typescript.git cd uipath-typescript npm install npm run build ``` -------------------------------- ### Start UiPath Process (TypeScript) Source: https://uipath.github.io/uipath-typescript/llms-full-content Initiates the execution of a UiPath process with a specified configuration. This method requires a ProcessStartRequest object detailing the process to start, the folder ID, and optional request options. It returns a promise that resolves to an array of ProcessStartResponse objects, indicating the status of the started process instances. ```typescript // Start a process const startedProcesses = await sdk.processes.start({ // ... ProcessStartRequest configuration ... }, ); ``` -------------------------------- ### UiPath Assets API getAll() Method Example Source: https://uipath.github.io/uipath-typescript/llms-full-content Provides an example of using the `getAll()` method of the UiPath Assets API. This method can retrieve all assets, filter by folder, or be used with pagination options like `pageSize`, `cursor`, and `jumpToPage`. The return type depends on whether pagination options are provided. ```typescript // Standard array return const assets = await sdk.assets.getAll(); // With folder const folderAssets = await sdk.assets.getAll({ folderId: }); // First page with pagination const page1 = await sdk.assets.getAll({ pageSize: 10 }); // Navigate using cursor if (page1.hasNextPage) { const page2 = await sdk.assets.getAll({ cursor: page1.nextCursor }); } // Jump to specific page const page5 = await sdk.assets.getAll({ jumpToPage: 5, pageSize: 10 }); ``` -------------------------------- ### Get Direct Download URL for a File (TypeScript) Source: https://uipath.github.io/uipath-typescript/llms-full-content Provides an example of how to obtain a direct, temporary download URL for a file stored in a UiPath bucket. Requires bucket ID, folder ID, and the file path. ```typescript const fileAccess = await sdk.buckets.getReadUri({ bucketId: , folderId: , path: '/folder/file.pdf' }); ``` -------------------------------- ### Example: OAuth Authentication (Requires initialize) (TypeScript) Source: https://uipath.github.io/uipath-typescript/authentication Illustrates the process of initializing the UiPath SDK with OAuth credentials, emphasizing the mandatory call to `await sdk.initialize()`. This example includes error handling for the initialization process and demonstrates fetching tasks after successful initialization. ```typescript const sdk = new UiPath({ baseUrl: 'https://cloud.uipath.com', orgName: 'your-organization', tenantName: 'your-tenant', clientId: 'your-client-id', redirectUri: 'http://localhost:3000', scope: 'your-scopes' }); // Must initialize before using services try { await sdk.initialize(); console.log('SDK initialized successfully'); // Now you can use the SDK const tasks = await sdk.tasks.getAll(); } catch (error) { console.error('Failed to initialize SDK:', error); } ``` -------------------------------- ### Basic Pagination Example Source: https://uipath.github.io/uipath-typescript/pagination_q= Demonstrates how to fetch the first page of results with a specified page size. ```APIDOC ## Usage Examples ### Basic Pagination ```typescript // Get first page with 10 items const firstPage = await sdk.assets.getAll({ pageSize: 10 }); console.log(`Got ${firstPage.items.length} items`); console.log(`Total items: ${firstPage.totalCount}`); console.log(`Has next page: ${firstPage.hasNextPage}`); ``` ``` -------------------------------- ### Get Process Instance Variables - TypeScript Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessInstancesServiceModel Shows how to retrieve global variables for a process instance. The example demonstrates fetching all variables and then specifically filtering them by a parent element ID. It also shows how to access and iterate through the global variables. ```typescript // Get all variables for a process instance const variables = await sdk.maestro.processes.instances.getVariables( , ); // Access global variables console.log('Global variables:', variables.globalVariables); // Iterate through global variables with metadata variables.globalVariables?.forEach(variable => { console.log(`Variable: ${variable.name} (${variable.id})`); console.log(` Type: ${variable.type}`); console.log(` Element: ${variable.elementId}`); console.log(` Value: ${variable.value}`); }); // Get variables for a specific parent element const variables = await sdk.maestro.processes.instances.getVariables( , , { parentElementId: } ); ``` -------------------------------- ### Start UiPath Process (TypeScript) Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel_q= Initiates the execution of a specified automation process. It requires a process identifier (key or name) and a folder ID, returning a promise that resolves to an array of started process instances. ```typescript const process = await sdk.processes.start({ processKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }, ); const process = await sdk.processes.start({ processName: "MyProcess" }, ); ``` -------------------------------- ### Get Process Instance Incidents - TypeScript Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessInstancesServiceModel Illustrates how to fetch incidents associated with a specific process instance. The example shows how to retrieve the incidents and then iterate through them to access details like element name, severity, and error messages. ```typescript // Get incidents for a specific instance const incidents = await sdk.maestro.processes.instances.getIncidents('', ''); // Access process incident details for (const incident of incidents) { console.log(`Element: ${incident.incidentElementActivityName} (${incident.incidentElementActivityType})`); console.log(`Severity: ${incident.incidentSeverity}`); console.log(`Error: ${incident.errorMessage}`); } ``` -------------------------------- ### GET /assets Source: https://uipath.github.io/uipath-typescript/api/interfaces/AssetServiceModel Gets all assets across folders with optional filtering and pagination. ```APIDOC ## GET /assets ### Description Gets all assets across folders with optional filtering and pagination. ### Method GET ### Endpoint /assets ### Parameters #### Query Parameters - **folderId** (number) - Optional - The ID of the folder to retrieve assets from. - **pageSize** (number) - Optional - The number of assets to return per page. - **jumpToPage** (number) - Optional - The page number to jump to. - **cursor** (string) - Optional - The cursor for retrieving the next page of results. ### Request Example ```javascript // Standard array return const assets = await sdk.assets.getAll(); // With folder const folderAssets = await sdk.assets.getAll({ folderId: }); // First page with pagination const page1 = await sdk.assets.getAll({ pageSize: 10 }); // Navigate using cursor if (page1.hasNextPage) { const page2 = await sdk.assets.getAll({ cursor: page1.nextCursor }); } // Jump to specific page const page5 = await sdk.assets.getAll({ jumpToPage: 5, pageSize: 10 }); ``` ### Response #### Success Response (200) - **assets** (array) - An array of AssetGetResponse objects. - **hasNextPage** (boolean) - Indicates if there is a next page of results. - **nextCursor** (string) - The cursor for the next page of results. #### Response Example ```json { "assets": [ { "id": 1, "name": "ExampleAsset", "value": "ExampleValue", "folderId": 10, "type": "String", "description": "An example asset" } ], "hasNextPage": true, "nextCursor": "someCursorString" } ``` ``` -------------------------------- ### GET /processes Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel Gets all processes across folders with optional filtering. Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided, or a PaginatedResponse when any pagination parameter is provided. ```APIDOC ## GET /processes ### Description Gets all processes across folders with optional filtering. Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided, or a PaginatedResponse when any pagination parameter is provided. ### Method GET ### Endpoint /processes ### Parameters #### Query Parameters - **options** (ProcessGetAllOptions) - Optional - Query options including optional folderId and pagination options ### Request Example ```javascript // Standard array return const processes = await sdk.processes.getAll(); // Get processes within a specific folder const processes = await sdk.processes.getAll({ folderId: }); // Get processes with filtering const processes = await sdk.processes.getAll({ filter: "name eq 'MyProcess'" }); // First page with pagination const page1 = await sdk.processes.getAll({ pageSize: 10 }); // Navigate using cursor if (page1.hasNextPage) { const page2 = await sdk.processes.getAll({ cursor: page1.nextCursor }); } // Jump to specific page const page5 = await sdk.processes.getAll({ jumpToPage: 5, pageSize: 10 }); ``` ### Response #### Success Response (200) - **data** (ProcessGetResponse[]) - Array of processes or paginated response - **totalCount** (number) - Total number of processes (only for non-paginated responses) #### Response Example ```json { "data": [ { "id": 1, "name": "MyProcess", "folderId": 10, "description": "My process description" } ], "totalCount": 5 } ``` ``` -------------------------------- ### GET /processes Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel_q= Gets all processes across folders with optional filtering. Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided, or a PaginatedResponse when any pagination parameter is provided. ```APIDOC ## GET /processes ### Description Gets all processes across folders with optional filtering. Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided, or a PaginatedResponse when any pagination parameter is provided. ### Method GET ### Endpoint /processes ### Parameters #### Query Parameters - **options** (ProcessGetAllOptions) - Optional - Query options including optional folderId and pagination options ### Request Example ```javascript // Standard array return const processes = await sdk.processes.getAll(); // Get processes within a specific folder const processes = await sdk.processes.getAll({ folderId: }); // Get processes with filtering const processes = await sdk.processes.getAll({ filter: "name eq 'MyProcess'" }); // First page with pagination const page1 = await sdk.processes.getAll({ pageSize: 10 }); // Navigate using cursor if (page1.hasNextPage) { const page2 = await sdk.processes.getAll({ cursor: page1.nextCursor }); } // Jump to specific page const page5 = await sdk.processes.getAll({ jumpToPage: 5, pageSize: 10 }); ``` ### Response #### Success Response (200) - **data** (ProcessGetResponse[]) - An array of processes. - **totalCount** (number) - The total number of processes available. - **hasNextPage** (boolean) - Indicates if there is a next page of results. - **nextCursor** (string) - The cursor for the next page of results. #### Response Example ```json { "data": [ { "id": 1, "name": "MyProcess", "description": "This is my process." } ], "totalCount": 10, "hasNextPage": true, "nextCursor": "someCursor" } ``` ``` -------------------------------- ### Cursor-based Navigation Example Source: https://uipath.github.io/uipath-typescript/pagination_q= Illustrates how to iterate through all pages of results using `nextCursor`. ```APIDOC ### Cursor-based Navigation ```typescript // Navigate through pages using cursors let currentPage = await sdk.assets.getAll({ pageSize: 10 }) as PaginatedResponse; while (currentPage.hasNextPage) { // Process current page items currentPage.items.forEach(item => console.log(item.name)); // Get next page using cursor currentPage = await sdk.assets.getAll({ cursor: currentPage.nextCursor }) as PaginatedResponse; } ``` ``` -------------------------------- ### Non-paginated Requests Example Source: https://uipath.github.io/uipath-typescript/pagination_q= Demonstrates how to fetch all items without applying any pagination parameters. ```APIDOC ### Non-paginated Requests ```typescript // Get all items without pagination const allAssets = await sdk.assets.getAll(); console.log(`Retrieved ${allAssets.items.length} assets`); console.log(`Total count: ${allAssets.totalCount}`); ``` ``` -------------------------------- ### ProcessStartResponse Interface Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessStartResponse This section details the properties of the ProcessStartResponse interface, which is returned when a process is started. It includes information about job priority, input/output arguments, state, and more. ```APIDOC ## ProcessStartResponse ### Description Interface for job response. This object contains details about a started job. ### Method N/A (This is an interface definition, not an endpoint) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **jobPriority** (JobPriority) - Optional - The priority of the job. - **specificPriorityValue** (number) - Optional - The specific numerical value for priority. - **inputArguments** (string) - Optional - The input arguments for the process. - **environmentVariables** (string) - Optional - Environment variables for the process. - **entryPointPath** (string) - Optional - The entry point path for the process. - **remoteControlAccess** (RemoteControlAccess) - Optional - Remote control access configuration. - **requiresUserInteraction** (boolean) - Optional - Indicates if user interaction is required. - **folderId** (number) - Optional - The ID of the folder the process belongs to. - **folderName** (string) - Optional - The name of the folder the process belongs to. - **key** (string) - Required - The unique key of the job. - **startTime** (null | string) - Required - The start time of the job. - **endTime** (null | string) - Required - The end time of the job. - **state** (JobState) - Required - The current state of the job. - **source** (string) - Required - The source of the job. - **sourceType** (string) - Required - The type of the source. - **batchExecutionKey** (string) - Required - The key for batch execution. - **info** (null | string) - Required - Additional information about the job. - **createdTime** (string) - Required - The time the job was created. - **startingScheduleId** (null | number) - Required - The ID of the schedule that started the job. - **processName** (string) - Required - The name of the process. - **type** (JobType) - Required - The type of the job. - **inputFile** (null | string) - Required - The input file for the job. - **outputArguments** (null | string) - Required - The output arguments of the job. - **outputFile** (null | string) - Required - The output file of the job. - **hostMachineName** (null | string) - Required - The name of the host machine. - **persistenceId** (null | string) - Required - The persistence ID of the job. - **resumeVersion** (null | number) - Required - The resume version of the job. - **stopStrategy** (null | StopStrategy) - Required - The stop strategy for the job. - **runtimeType** (string) - Required - The runtime type of the job. - **processVersionId** (null | number) - Required - The ID of the process version. - **reference** (string) - Required - A reference to the job. - **packageType** (PackageType) - Required - The type of the package. - **machine** (Machine) - Optional - Information about the machine the job is running on. - **resumeOnSameContext** (boolean) - Required - Indicates if the job should resume on the same context. - **localSystemAccount** (string) - Required - The local system account used for the job. - **orchestratorUserIdentity** (null | string) - Required - The orchestrator user identity. - **startingTriggerId** (null | string) - Required - The ID of the trigger that started the job. - **maxExpectedRunningTimeSeconds** (null | number) - Required - The maximum expected running time in seconds. - **parentJobKey** (null | string) - Required - The key of the parent job. - **resumeTime** (null | string) - Required - The time the job was resumed. - **lastModifiedTime** (null | string) - Required - The last modified time of the job. - **jobError** (null | JobError) - Required - Information about any job error. - **errorCode** (null | string) - Required - The error code if an error occurred. - **robot** (RobotMetadata) - Optional - Metadata about the robot executing the job. - **id** (number) - Required - The unique identifier of the job. #### Response Example ```json { "jobPriority": "Normal", "specificPriorityValue": null, "inputArguments": "{\"argument1\": \"value1\"}", "environmentVariables": "{\"ENV_VAR\": \"test\"}", "entryPointPath": null, "remoteControlAccess": null, "requiresUserInteraction": false, "folderId": 123, "folderName": "DefaultFolder", "key": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "startTime": "2023-10-27T10:00:00Z", "endTime": null, "state": "Running", "source": "UiPath.Executor", "sourceType": "Executor", "batchExecutionKey": null, "info": null, "createdTime": "2023-10-27T09:59:58Z", "startingScheduleId": null, "processName": "MyProcess", "type": "Background", "inputFile": null, "outputArguments": null, "outputFile": null, "hostMachineName": null, "persistenceId": null, "resumeVersion": null, "stopStrategy": null, "runtimeType": "Managed", "processVersionId": 456, "reference": "MyProcess_v1.0", "packageType": "Process", "machine": { "id": 789, "name": "MachineName" }, "resumeOnSameContext": false, "localSystemAccount": "SYSTEM", "orchestratorUserIdentity": null, "startingTriggerId": null, "maxExpectedRunningTimeSeconds": null, "parentJobKey": null, "resumeTime": null, "lastModifiedTime": "2023-10-27T10:00:05Z", "jobError": null, "errorCode": null, "robot": { "id": 101, "name": "RobotName" }, "id": 112233 } ``` ``` -------------------------------- ### Page Jumping Example Source: https://uipath.github.io/uipath-typescript/pagination_q= Shows how to jump directly to a specific page number, if supported by the endpoint. ```APIDOC ### Page Jumping ```typescript // Jump directly to page 5 (when supported) const page5 = await sdk.assets.getAll({ jumpToPage: 5, pageSize: 20 }); // Check if page jumping is supported if (page5.supportsPageJump) { console.log(`Currently on page ${page5.currentPage} of ${page5.totalPages}`); } ``` ``` -------------------------------- ### Maestro Processes API - Get All Source: https://uipath.github.io/uipath-typescript/llms-full-content Retrieves a list of all available UiPath Maestro processes. ```APIDOC ## GET /maestro/processes/getAll ### Description Retrieves a list of all available UiPath Maestro processes. ### Method GET ### Endpoint /maestro/processes/getAll ### Response #### Success Response (200) - **processes** (array) - An array of MaestroProcess objects. - **processKey** (string) - The unique key of the process. - **runningCount** (number) - The number of currently running instances of the process. - **faultedCount** (number) - The number of instances of the process that have faulted. - **getIncidents** (function) - A function to retrieve incidents for this specific process. #### Response Example ```json [ { "processKey": "process-abc-123", "runningCount": 5, "faultedCount": 1, "getIncidents": "[Function: getIncidents]" } ] ``` ``` -------------------------------- ### GET /process-instances/{instanceId}/bpmn Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessInstancesServiceModel Retrieves the BPMN XML file for a specific process instance. ```APIDOC ## GET /process-instances/{instanceId}/bpmn ### Description Get BPMN XML file for a process instance. ### Method GET ### Endpoint /process-instances/{instanceId}/bpmn ### Parameters #### Path Parameters - **instanceId** (string) - Required - The ID of the instance to get BPMN for. #### Query Parameters - **folderKey** (string) - Required - The folder key for authorization. ### Request Example ```javascript // Get BPMN XML for a process instance const bpmnXml = await sdk.maestro.processes.instances.getBpmn( '', '' ); // Render BPMN diagram in frontend using bpmn-js import BpmnViewer from 'bpmn-js/lib/Viewer'; const viewer = new BpmnViewer({ container: '#bpmn-diagram' }); await viewer.importXML(bpmnXml); // Zoom to fit the diagram viewer.get('canvas').zoom('fit-viewport'); ``` ### Response #### Success Response (200) - **bpmnXml** (string) - The BPMN XML content as a string. #### Response Example ```xml ... ``` ``` -------------------------------- ### GET /process-instances/{instanceId}/bpmn Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessInstancesServiceModel_q= Retrieves the BPMN XML file for a specific process instance. ```APIDOC ## GET /process-instances/{instanceId}/bpmn ### Description Get BPMN XML file for a process instance. ### Method GET ### Endpoint /process-instances/{instanceId}/bpmn ### Parameters #### Path Parameters - **instanceId** (string) - Required - The ID of the instance to get BPMN for. #### Query Parameters - **folderKey** (string) - Required - The folder key for authorization. ### Request Example ```json { "example": "// Get BPMN XML for a process instance\nconst bpmnXml = await sdk.maestro.processes.instances.getBpmn(\n '',\n ''\n);\n\n// Render BPMN diagram in frontend using bpmn-js\nimport BpmnViewer from 'bpmn-js/lib/Viewer';\n\nconst viewer = new BpmnViewer({ container: '#bpmn-diagram' }); await viewer.importXML(bpmnXml);\n // Zoom to fit the diagram viewer.get('canvas').zoom('fit-viewport');" } ``` ### Response #### Success Response (200) - **bpmnXml** (string) - The BPMN XML content as a string. #### Response Example ```json { "example": "\n\n ...\n" } ``` ``` -------------------------------- ### GET /processes/{id} Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel Gets a single process by ID. ```APIDOC ## GET /processes/{id} ### Description Gets a single process by ID. ### Method GET ### Endpoint /processes/{id} ### Parameters #### Path Parameters - **id** (number) - Required - Process ID - **folderId** (number) - Required - Required folder ID #### Query Parameters - **options** (BaseOptions) - Optional - Optional query parameters ### Request Example ```javascript // Get process by ID const process = await sdk.processes.getById(, ); ``` ### Response #### Success Response (200) - **id** (number) - Process ID - **name** (string) - Process name - **folderId** (number) - Folder ID - **description** (string) - Process description #### Response Example ```json { "id": 1, "name": "MyProcess", "folderId": 10, "description": "My process description" } ``` ``` -------------------------------- ### GET /processes/{id} Source: https://uipath.github.io/uipath-typescript/api/interfaces/ProcessServiceModel_q= Gets a single process by ID. ```APIDOC ## GET /processes/{id} ### Description Gets a single process by ID. ### Method GET ### Endpoint /processes/{id} ### Parameters #### Path Parameters - **id** (number) - Required - Process ID - **folderId** (number) - Required - Required folder ID #### Query Parameters - **options** (BaseOptions) - Optional - Optional query parameters ### Request Example ```javascript // Get process by ID const process = await sdk.processes.getById(, ); ``` ### Response #### Success Response (200) - **id** (number) - The process ID. - **name** (string) - The process name. - **description** (string) - The process description. #### Response Example ```json { "id": 1, "name": "MyProcess", "description": "This is my process." } ``` ``` -------------------------------- ### Basic Pagination Example - TypeScript Source: https://uipath.github.io/uipath-typescript/pagination Demonstrates how to fetch the first page of items with a specified page size and log the response details. This is a fundamental usage pattern for retrieving paginated data. ```typescript // Get first page with 10 items const firstPage = await sdk.assets.getAll({ pageSize: 10 }); console.log(`Got ${firstPage.items.length} items`); console.log(`Total items: ${firstPage.totalCount}`); console.log(`Has next page: ${firstPage.hasNextPage}`); ``` -------------------------------- ### GET /queues/{id} Source: https://uipath.github.io/uipath-typescript/api/interfaces/QueueServiceModel_q= Gets a single queue by its ID. ```APIDOC ## GET /queues/{id} ### Description Gets a single queue by its ID. ### Method GET ### Endpoint /queues/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the queue to retrieve. #### Query Parameters - **folderId** (number) - Required - The ID of the folder containing the queue. ### Request Example ```javascript // Get queue by ID const queue = await sdk.queues.getById(, ); ``` ### Response #### Success Response (200) - **queue** (object) - A QueueGetResponse object representing the queue. #### Response Example ```json { "id": 1, "name": "ExampleQueue", "description": "A sample queue", "creationTime": "2023-10-27T10:00:00Z", "lastModifiedTime": "2023-10-27T10:00:00Z", "organizationUnitId": 101 } ``` ``` -------------------------------- ### GET /assets/{id} Source: https://uipath.github.io/uipath-typescript/api/interfaces/AssetServiceModel Gets a single asset by its ID. ```APIDOC ## GET /assets/{id} ### Description Gets a single asset by its ID. ### Method GET ### Endpoint /assets/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the asset to retrieve. - **folderId** (number) - Required - The ID of the folder the asset belongs to. #### Query Parameters - **expand** (string) - Optional - Comma-separated list of properties to expand. - **select** (string) - Optional - Comma-separated list of properties to select. ### Request Example ```javascript // Get asset by ID const asset = await sdk.assets.getById(, ); ``` ### Response #### Success Response (200) - **asset** (object) - An AssetGetResponse object representing the retrieved asset. #### Response Example ```json { "id": 1, "name": "ExampleAsset", "value": "ExampleValue", "folderId": 10, "type": "String", "description": "An example asset" } ``` ``` -------------------------------- ### Quick Test Script for Authentication Source: https://uipath.github.io/uipath-typescript/llms-full-content A script to verify your authentication setup using environment variables for credentials and making a sample API call. ```APIDOC ## Quick Test Script for Authentication ### Description This script helps you quickly test your authentication credentials by reading them from a `.env` file and making a call to the assets API. ### Setup 1. Create a `.env` file in your project root: ``` # .env UIPATH_BASE_URL=https://cloud.uipath.com UIPATH_ORG_NAME=your-organization-name UIPATH_TENANT_NAME=your-tenant-name UIPATH_SECRET=your-pat-token ``` ### Script (`test-auth.ts`) ```typescript import 'dotenv/config'; import { UiPath } from '@uipath/uipath-typescript'; async function testAuthentication() { const sdk = new UiPath({ baseUrl: process.env.UIPATH_BASE_URL!, orgName: process.env.UIPATH_ORG_NAME!, tenantName: process.env.UIPATH_TENANT_NAME!, secret: process.env.UIPATH_SECRET! }); try { // Test with a simple API call const assets = await sdk.assets.getAll(); console.log('🎉 Authentication successful!'); console.log(`✅ Connected to ${process.env.UIPATH_ORG_NAME}/${process.env.UIPATH_TENANT_NAME}`); console.log(`✅ Found ${assets.length} assets`); } catch (error) { console.error('❌ Authentication failed:'); console.error(error.message); } } testAuthentication(); ``` ### Running the Script Execute the script using Node.js: ```bash npx ts-node test-auth.ts ``` ``` -------------------------------- ### GET /queues Source: https://uipath.github.io/uipath-typescript/api/interfaces/QueueServiceModel_q= Gets all queues across folders with optional filtering and folder scoping. Supports pagination. ```APIDOC ## GET /queues ### Description Gets all queues across folders with optional filtering and folder scoping. Supports pagination. ### Method GET ### Endpoint /queues ### Parameters #### Query Parameters - **folderId** (number) - Optional - The ID of the folder to scope the search to. - **filter** (string) - Optional - A filter string to apply to the search (e.g., "name eq 'MyQueue'"). - **pageSize** (number) - Optional - The number of items to return per page for pagination. - **jumpToPage** (number) - Optional - The specific page number to retrieve. - **cursor** (string) - Optional - The cursor for navigating to the next or previous page. ### Request Example ```javascript // Standard array return const queues = await sdk.queues.getAll(); // Get queues within a specific folder const queues = await sdk.queues.getAll({ folderId: }); // Get queues with filtering const queues = await sdk.queues.getAll({ filter: "name eq 'MyQueue'" }); // First page with pagination const page1 = await sdk.queues.getAll({ pageSize: 10 }); // Navigate using cursor if (page1.hasNextPage) { const page2 = await sdk.queues.getAll({ cursor: page1.nextCursor }); } // Jump to specific page const page5 = await sdk.queues.getAll({ jumpToPage: 5, pageSize: 10 }); ``` ### Response #### Success Response (200) - **queues** (array) - An array of QueueGetResponse objects. - **hasNextPage** (boolean) - Indicates if there is a next page of results. - **nextCursor** (string) - The cursor for the next page of results. #### Response Example ```json { "queues": [ { "id": 1, "name": "ExampleQueue", "description": "A sample queue", "creationTime": "2023-10-27T10:00:00Z", "lastModifiedTime": "2023-10-27T10:00:00Z", "organizationUnitId": 101 } ], "hasNextPage": true, "nextCursor": "someCursorString" } ``` ``` -------------------------------- ### Secret Authentication Initialization Example Source: https://uipath.github.io/uipath-typescript/llms-full-content Demonstrates using the UiPath SDK with secret-based authentication. The SDK is automatically initialized upon instance creation, allowing immediate use of its services. ```typescript const sdk = new UiPath({ baseUrl: 'https://cloud.uipath.com', orgName: 'your-organization', tenantName: 'your-tenant', secret: 'your-secret' //PAT Token or Bearer Token }); // Ready to use immediately - no initialize() needed const tasks = await sdk.tasks.getAll(); ``` -------------------------------- ### Basic Pagination Usage with UiPath SDK Source: https://uipath.github.io/uipath-typescript/llms-full-content Demonstrates basic pagination usage with the UiPath SDK's `assets.getAll` method. It shows how to request a specific number of items per page and access information about the retrieved page. ```typescript // Get first page with 10 items const firstPage = await sdk.assets.getAll({ pageSize: 10 }); console.log(`Got ${firstPage.items.length} items`); console.log(`Total items: ${firstPage.totalCount}`); console.log(`Has next page: ${firstPage.hasNextPage}`); ``` -------------------------------- ### GET /instances/{instanceId}/history Source: https://uipath.github.io/uipath-typescript/api/interfaces/CaseInstancesServiceModel Get execution history for a case instance. Retrieves the execution history logs for a specific case instance. ```APIDOC ## GET /instances/{instanceId}/history ### Description Get execution history for a case instance. Retrieves the execution history logs for a specific case instance. ### Method GET ### Endpoint /instances/{instanceId}/history ### Parameters #### Path Parameters - **instanceId** (string) - Required - The ID of the instance to get history for. - **folderKey** (string) - Required - Required folder key. ### Response #### Success Response (200) - **history** (Array) - An array of execution log entries. #### Response Example ```json { "history": [ { "timestamp": "2023-10-27T10:05:00Z", "activityName": "StartProcess", "status": "Completed" }, { "timestamp": "2023-10-27T10:10:00Z", "activityName": "ValidateData", "status": "Completed" } ] } ``` ``` -------------------------------- ### Pagination Overview Source: https://uipath.github.io/uipath-typescript/llms-full-content Explains the two pagination approaches supported by the SDK: cursor-based navigation and page jumping. ```APIDOC ## Pagination Overview ### Description The UiPath SDK supports two primary methods for handling paginated API responses: cursor-based navigation and page jumping. You can use either method, but not both simultaneously. ### Pagination Approaches 1. **Cursor-based Navigation**: Utilizes opaque cursors to move sequentially through pages of results. 2. **Page Jump**: Allows direct navigation to a specific page number, where supported. ### Response Types - **`PaginatedResponse`**: Returned when pagination parameters (like `cursor` or `jumpToPage`) are provided. Contains items, pagination metadata, and cursors. - **`NonPaginatedResponse`**: Returned when no pagination parameters are specified. Contains only the items. ### Usage Specify either `cursor` OR `jumpToPage` in your request options. All paginated methods will return a `PaginatedResponse` if pagination parameters are used. ``` -------------------------------- ### GET /folders/{folderId}/users Source: https://uipath.github.io/uipath-typescript/api/interfaces/TaskServiceModel Gets users in the given folder who have Tasks.View and Tasks.Edit permissions. Returns paginated or non-paginated responses based on the presence of pagination parameters. ```APIDOC ## GET /folders/{folderId}/users ### Description Gets users in the given folder who have Tasks.View and Tasks.Edit permissions. Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided, or a PaginatedResponse when any pagination parameter is provided. ### Method GET ### Endpoint /folders/{folderId}/users ### Parameters #### Path Parameters - **folderId** (number) - Required - The folder ID to get users from #### Query Parameters - **options** (T) - Optional - Optional query and pagination parameters ### Response #### Success Response (200) - **items** (UserLoginInfo[]) - Array of user login information - **totalCount** (number) - Total number of users (present in NonPaginatedResponse) #### Response Example ```json { "items": [ { "id": 1, "name": "John Doe", "emailAddress": "john.doe@example.com" } ], "totalCount": 1 } ``` ``` -------------------------------- ### OAuth Authentication Source: https://uipath.github.io/uipath-typescript/llms-full-content Demonstrates how to initialize the UiPath SDK using OAuth for authentication. It covers the basic initialization process and how to handle potential errors. ```APIDOC ## OAuth Authentication Example ### Description This example shows how to initialize the UiPath SDK with OAuth credentials. It's crucial to call `sdk.initialize()` before using any other SDK services. ### Method `sdk.initialize()` ### Parameters - `baseUrl` (string) - Required - The base URL for the UiPath Cloud instance. - `orgName` (string) - Required - The name of your UiPath organization. - `tenantName` (string) - Required - The name of your UiPath tenant. - `clientId` (string) - Required - Your OAuth application's client ID. - `redirectUri` (string) - Required - The URI to redirect to after authentication. - `scope` (string) - Required - The requested OAuth scopes. ### Request Example ```typescript const sdk = new UiPath({ baseUrl: 'https://cloud.uipath.com', orgName: 'your-organization', tenantName: 'your-tenant', clientId: 'your-client-id', redirectUri: 'http://localhost:3000', scope: 'your-scopes' }); try { await sdk.initialize(); console.log('SDK initialized successfully'); // Now you can use the SDK, e.g., const tasks = await sdk.tasks.getAll(); } catch (error) { console.error('Failed to initialize SDK:', error); } ``` ### Response #### Success Response (Initialization) - `void` - The SDK is initialized and ready for use. #### Error Response - `Error` - Thrown if initialization fails. ```