Base

Base serves as the repository for all components that are common across all modules and remote procedures. Any elements placed in Base will be inherited by each module and remote procedure.

These components are:

Base URLAuthorizationError handlingSanitization
{
    "baseUrl": "",
    "headers": {},
    "qs": {},
    "body": {},
    "response": {},
    "log": {
        "sanitize": []
        },
    "oauth": {}
}

Key

Type

Description

baseUrl

String

If you want to use this base URL in a request, you need to start the URL of an endpoint with / character.

headers

Object

Default headers that every module will use.

qs

Object

Default query string parameters that every module will use.

body

Object

Default request body that every module will use when issuing a POST or PUT request.

response

Object

Default directives for handling response, such as error handling.

log

Object

Default directive for handling logs, such as sanitization of sensitive data.

Oauth 1 Parameter Specification

Collection of directives containing parameters for the OAuth 1 protocol.

Example

{
    "baseUrl": "https://my.api.cz/2.0",
    "headers": {
        "authorization": "Basic {{base64(connection.username + ':' + connection.password)}}"
    },
    "response": {
        "valid": {
            "condition": "{{body.status != 'error'}}"
        },
        "error": {
            "200": {
                "message": "{{ifempty(errors(body.message), body.message)}}"
            },
            "message": "[{{statusCode}}]: {{body.reason}}"
        }
    },
    "log": {
        "sanitize": [
            "request.headers.authorization"
        ]
    }
}

Everything specified in the base is inherited by all modules and RPCs. You can see the baseUrl, authorization being sent in headers, an error handler and a sanitization. Those parameters will be used across all the modules and RPCs.

Common Data

When you want the Common Data to be available only to the connection (for example for storing OAuth secrets), use Connections' common data instead.

Once the app becomes Approved, the Common Data gets locked and it cannot be changed anymore due to security reasons.

Common Data can be accessed by common.variable IML expression.

Example

{
	"secret": "AABBCCDD"
}

As you can see, the secret is defined in the common data. Then it can be used in base and in all other communication objects inside modules and RPCs. Once the app becomes approved, it will not be possible to change the secret.

By default, requests time out after 40 seconds. If your API typically performs tasks that exceed this duration, you can increase the timeout—up to a maximum of 300 seconds (or 300,000 milliseconds).

To adjust the timeout, specify the desired duration in the base and common data settings (in milliseconds). This timeout will apply to the entire custom app. We recommend the following approach (example using a 300 seconds timeout):

{
	"timeout": 300000
}

The timeout should only be extended if the API performs legitimately resource-intensive operations, such as video/image processing, file conversion, or complex AI computations, etc.

Last updated