NAV
cURL JavaScript

Converter

Authentication for the converter api can be done using an apiKey and apiSecret pair or can be done using a JWT token. If a jwt token is used --user apiKey:apiSecret can be replaced with -header 'Authorization: Bearer <jwt-token>'.

The Waylay multitenant service that stores all converters can be found at https://converter.waylay.io

Create/update a converter

curl --user apiKey:apiSecret --request PUT -H 'Content-Type: application/json' 'https://converter.waylay.io/converter/:converter' \
--data-raw '{
               "template": "<escaped velocity template as string>",
                "type": "velocity"
            }'

The velocity template needs to be escaped so it can be sent in the json object as a string. An escape tool like this can be used.

Remove a converter

WARNING: When removing a converter, make sure the converter is not in use anymore. Removing a converter that is in use may result in data being lost.

curl --user apiKey:apiSecret --request DELETE 'https://converter.waylay.io/converter/:converter'

Show configuration for converter

curl --user apiKey:apiSecret --request GET 'https://converter.waylay.io/converter/:converter'

Show all configuration for tenant

curl --user apiKey:apiSecret --request GET 'https://converter.waylay.io/converter/'

Convert data

This endpoint will convert a payload using a converter that is stored.

curl --user apiKey:apiSecret -i -X POST -H "Content-Type: multipart/form-data" \
--form 'payload=@<path-to-folder>/payload.json;type=application/json' 'https://converter.waylay.io/converter/:converter/convert?forward=true'

Forward querysting parameter

Forward can be either true or false, when true the converted payload will also be forwarded to broker.

Test a converter

Before creating your converter and making it available to the connectors, it is possible to test it using the test endpoint.

curl --user apiKey:apiSecret -i -X POST -H "Content-Type: multipart/form-data" \
--form 'config=@<path-to-folder>/config.json;type=application/json' \
--form 'payload=@<path-to-folder>/payload.json;type=application/json' 'https://converter.waylay.io/converter/test'