Skip to content

executeHttp

Call Signature

executeHttp(uipath: IUiPath, connectionId: string, url: string, method?: ExecuteMethod, options?: ExecuteHttpOptions): Promise<ExecuteHttpResult>

Experimental

Send an HTTP request to a vendor API through a connection. Integration Service adds the connection's authentication, so the vendor's key or token never reaches your code.

Warning

Preview: This function is experimental and may change or be removed in future releases.

Use this for a vendor endpoint the connector has no object for. For a connector object or activity, use executeActivity.

The result describes the vendor's response: status, headers and body are the vendor's. This does not throw on non-2xx responses — check ok, and isVendorError to tell a vendor error from a call that never reached the vendor.

A vendor error status, a 429 or 5xx included, is returned as the result and is not retried: retry covers only a failure of the Integration Service call that carries the request.

When an admin remapped this connection id at deployment, the call targets the connection it was mapped to.

Parameters

Parameter Type Description
uipath IUiPath UiPath SDK instance providing authentication and configuration
connectionId string Connection GUID
url string Vendor URL. A path such as /v2/tickets is resolved against the connection's base URL
method? ExecuteMethod HTTP method to send to the vendor (defaults to GET)
options? ExecuteHttpOptions Headers, query params, body, folder scoping (folderId / folderKey / folderPath), and robustness knobs (retry, timeoutMs, signal)

Returns

Promise<ExecuteHttpResult>

Promise resolving to an ExecuteHttpResult

Examples

import { UiPath } from '@uipath/uipath-typescript/core';
import { executeHttp } from '@uipath/uipath-typescript/connections';

const sdk = new UiPath(config);
await sdk.initialize();

// GET a vendor endpoint
const result = await executeHttp(sdk, '<connectionId>', '/v2/tickets');
if (result.ok) {
  console.log(result.body);
} else if (result.isVendorError) {
  console.error(`Vendor returned ${result.status}: ${JSON.stringify(result.body)}`);
}
// POST with headers, query params and a JSON body
const result = await executeHttp(sdk, '<connectionId>', '/v2/tickets', 'POST', {
  headers: { 'X-Request-Source': 'my-app' },
  queryParams: { notify: 'true' },
  body: { subject: 'New ticket', priority: 'high' },
});
// Retry a failed GET. A vendor POST is not retried unless listed in `retryMethods`.
const result = await executeHttp(sdk, '<connectionId>', '/v2/tickets', 'GET', {
  timeoutMs: 10_000,
  retry: { maxRetries: 3 },
});

Call Signature

executeHttp(uipath: IUiPath, connection: ConnectionResource, url: string, method?: ExecuteMethod, options?: ExecuteHttpOptions): Promise<ExecuteHttpResult>

Experimental

Send an HTTP request to a vendor API through a connection declared in uipath_resources.ts. Integration Service adds the connection's authentication.

Warning

Preview: This function is experimental and may change or be removed in future releases.

When an admin remapped the connection at deployment, the call targets the connection it was mapped to, in that connection's folder, even when a folder option is passed. Like the id form, this does not throw on non-2xx responses.

Parameters

Parameter Type Description
uipath IUiPath UiPath SDK instance providing authentication and configuration
connection ConnectionResource Handle created with resource.connection() from @uipath/uipath-typescript/resources
url string Vendor URL. A path such as /v2/tickets is resolved against the connection's base URL
method? ExecuteMethod HTTP method to send to the vendor (defaults to GET)
options? ExecuteHttpOptions Headers, query params, body, folder scoping (folderId / folderKey / folderPath), and robustness knobs (retry, timeoutMs, signal)

Returns

Promise<ExecuteHttpResult>

Promise resolving to an ExecuteHttpResult

Example

// uipath_resources.ts
import { resource } from '@uipath/uipath-typescript/resources';

export class ProjectResources {
  static readonly helpdesk = resource.connection({ id: '<connectionId>', connector: 'uipath-zendesk' });
}

// anywhere in the project
import { executeHttp } from '@uipath/uipath-typescript/connections';

const result = await executeHttp(sdk, ProjectResources.helpdesk, '/v2/tickets');