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
Here's an example of a REST API mapping for a list method:
# list.rest.yml
path: /tasks
method: get
requestMapping:
query:
limit: 100
offset:
$var: $.cursor
projectId:
$var: $.parameters.projectId
responseMapping:
records:
$var: response.data.data
cursor:
$var: response.data.next_page.offset
Format
The mapping specification includes:
path
– The API endpoint pathmethod
– HTTP method (GET, POST, PUT, PATCH, DELETE)requestMapping
– Request mappingquery
– Query parameters mappingheaders
– Headers mappingdata
– Request body mapping for POST/PUT/PATCHpathParameters
– 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
andconnectionParameters
variables instead.
- The only functions that don't have it are auth functions used before the connection is created. They have
- 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 dataheaders
– API response headersstatusCode
– API response status code
Updated 9 days ago