Skip to main content

ManagedAPIService

Script-engine API for reading Managed API definitions and performing OAuth token exchanges. Available in Journey Script steps, Rule script actions, and Script-sourced MeData Definitions.

Functions

getManagedAPIs

ManagedApiService.getManagedAPIs(): Promise<DataMap[]>

Retrieves all Managed APIs stored on the device.

Parameters: None.

getManagedAPI

ManagedApiService.getManagedAPI(
name: string
): Promise<DataMap | null>

Retrieves a single Managed API definition by its programmatic name.

Parameters:

  • name: string — Programmatic name of the Managed API.

startOAuth

ManagedApiService.startOAuth(
authUrl: string,
redirectUri: string,
queryName: string
): Promise<string>

Starts an OAuth authentication flow and returns the authorization code extracted from the redirect URL.

Parameters:

  • authUrl: string — OAuth authorization endpoint.
  • redirectUri: string — Redirect URI configured for your OAuth client.
  • queryName: string — Query parameter key used to extract the authorization code.

fetchTokenFromCode

ManagedApiService.fetchTokenFromCode(
tokenUrl: string,
httpMethod: "GET" | "POST"
): Promise<string>

Exchanges an OAuth authorization code for an access token.

Parameters:

  • tokenUrl: string — Token endpoint URL.
  • httpMethod: "GET" | "POST" — HTTP method to use for token exchange.

Classes

DataMap

{ [key: string]: string }