REST API Mapping

The REST API Mapping implementation type lets you map methods to REST API endpoints without writing code. This is useful when the method can be implemented with a single REST API call.

Use the following file naming structure for the REST API mapping implementation:

<method-name>.rest.yml

Example

# list.rest.yml
path: /contacts
method: GET
requestMapping:
  query:
    limit: 100
    offset: { $var: $.cursor }
    email: { $var: $.filter.email }
    first_name: { $var: $.filter.firstName }
    include_archived: { $var: $.parameters.includeArchived }
responseMapping:
  records: { $var: response.data.contacts }
  cursor: |
    {
      $cond: [
        { $var: response.data.hasMore },
        { $string: { $sum: [{ $number: { $var: $.cursor } }, 100] } },
        null
      ]
    }

Format

The mapping specification includes:

  • path – The API endpoint path
  • method – HTTP method (GET, POST, PUT, PATCH, DELETE)
  • requestMapping – Request mapping
    • query – Query parameters mapping
    • headers – Headers mapping
    • data – Request body mapping for POST/PUT/PATCH
    • pathParameters – Values for placeholders in the path (e.g., {projectId})
  • responseMapping – Mapping to transform the API response

Variables

Besides function-specific input variables described in each function's documentation, functions have the following variables available:

  • All functions inside the connector have credentials variable that contains credentials from the current connection.
    • The only functions that don't have it are auth functions used before the connection is created. They have connectorParameters and connectionParameters variables instead.
  • All data collection function have parameters variable that contains function-level parameters and collection-level paramteres combined.

For responseMapping, you get an additional response variable that has the following fields:

  • data – API response data
  • headers – API response headers
  • statusCode – API response status code