Using connector variables:

$headerParam

To use a header value informed in an API request through a connector, you must inform the name of the header key and use the variable $headerParam.<header key> in your instruction.

The example below is a request received by the API Platform and which will be sent to the connector:

curl --location --request GET 'https://myserver/myapi/v1' \
--header 'productId: 9c69483b-2953-3e88-a87a-4ad24416d87c'

In this request, there is a header with the key productId. To obtain the value of this header, $headerParam.productId must be used as follows:

(note that the example shows the variable of a SQL connector being used)

SELECT
   PRODUCT_NAME
FROM
   PRODUCTS
WHERE
   PRODUCT_ID = $headerParam.productId

And the example below shows the execution of the instruction by the connector:

SELECT
   PRODUCT_NAME
FROM
   PRODUCTS
WHERE
   PRODUCT_ID = 9c69483b-2953-3e88-a87a-4ad24416d87c

To enter the value as a string, use single quotes: '$headerParam.productId'

In the conversion, it will look like this: '9c69483b-2953-3e88-a87a-4ad24416d87c'

$pathParam

To use a path param value informed in an API request through a connector, you must inform the path param key name and use the variable $pathParam.<path param key> in your instruction.

As in the previous subsection, the example below is of a request received by the API Platform and which will be sent to a connector:

curl --location --request GET 'https://myserver/api/v1/products/560' \
--header 'Authorization: 9c69483b-2953-3e88-a87a-4ad24416d87c'

The request above has a path param with the key /products /{productId}. To obtain the path param value of, $pathParam.productId must be used as follows:

(example for a SQL connector)

SELECT
   PRODUCT_NAME
FROM
   PRODUCTS
WHERE
   PRODUCT_ID = $pathParam.productId

In the execution of the instruction by the connector, we will have:

SELECT
   PRODUCT_NAME
FROM
   PRODUCTS
WHERE
   PRODUCT_ID = 560

To enter the value as a string, use single quotes: '$pathParam.productId'

In the conversion, it will look like this: '560'

$queryParam

To use a query param value informed in an API request through a connector, you must enter the query param key name and use the variable $queryParam.<query param key>.

Example of a request to a connector:

curl --location --request GET 'https://myserver/myapi/v1/products/?productName=teste' \
--header 'Authorization: 9c69483b-2953-3e88-a87a-4ad24416d87c'

In this request, there is a query param with the key productName. To obtain its value, use $queryParam.productName as follows:

(example of a variable being used in a SQL connector)

SELECT
   PRODUCT_NAME, PRODUCT_ID, PRICE
FROM
   PRODUCTS
WHERE
   PRODUCT_NAME = '$queryParam.productName'

In the execution of the instruction by the connector, we will have:

SELECT
   PRODUCT_NAME, PRODUCT_ID, PRICE
FROM
   PRODUCTS
WHERE
   PRODUCT_NAME = 'test'

$body

To include into a database values passed in a request body, you must inform the body keys in the instructions to the connector and use the variable $body.<body key>, as in the example below.

Request received by the API Platform and which will be sent to a connector:

curl --location --request POST 'https://myserver/myapi/v1/products' \
--header 'Authorization: 9c69483b-2953-3e88-a87a-4ad24416d87c' \
--header 'Content-Type: application/json' \
--data-raw '{
    "productName": "test",
    "productPrice": "10.00"
}'

In the request above, we have a body with the keys productName and productPrice. You can insert their values into the database as follows:

(example of a variable being used in a SQL connector)

INSERT INTO PRODUCTS (PRODUCT_NAME, PRICE) VALUES ('$body.productName', '$body.productPrice');

In the execution of the instruction by the connector, we will have:

INSERT INTO PRODUCTS (PRODUCT_NAME, PRICE) VALUES ('test', '10.00');
Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]