Skip to main content

Fetch information from an external source using APIs

To use information from an external source in your process, you can fetch it via API, including APIs requiring OAuth 2.0 authentication.

To do this, follow these steps:

  1. Add a new service task to the process.

  2. Define Delegate expression to be ${API}.

  3. Configure the Class fields as described in the table:

Name

Required / Optional

Description

url

Required

URL to access the API.

If request parameters are used, embed them to the url as well.

authUrl

Optional, but required for OAuth 2.0

URL of the authentication service if OAuth 2.0 is used.

grantType

Optional

Authentication type:

  • client_credentials : for OAuth 2.0 using the username and password fields.

  • password : for OAuth 2.0 using the clientId, username and password fields.

  • if not defined, then the  username and password fields will be combined, encoded and passed as a header.

clientId

Optional, but required if grantType is password

External source's application Client ID.

username

Required

Username for the API authentication.

If grantType is client_credentials, then username is used as a Client ID.

If grantType is password, then username is used as a username.

password

Required

Password for the API authentication.

json

Optional

Defines the response format:

  • True (default): converts the response to key-value pairs.

  • False: returns the response as a string.

method

Optional

The API method to use in the request: POST (default) or GET.

body

Optional with method GET

Required with method POST

Request body to send in the API call.

For example, in GraphQL, the body would be structured as follows: { “query”:”<graphql query here>”}.

variableFilter

Optional

Comma-separated list of keys from the API response that you want to filter.

If you define a key with * at the end, then all key-value pairs in the response containing the defined key are returned. Without *, the exact match will be returned.

If you want to rename a key, define the following: Old key=New key, then the key is renamed with the value given after the = sign.

variableName

Optional

The prefix of the key names in the API response.

Example: <Variable name>-<Key name>.

If not specified, then Variable name is set to "api".