A data converter is a script or code that modifies the response body of an API request before it is saved. It is a function that may contain arguments. Use a data converter to modify or reformat the response body to an API call when the data cannot interact with the Workflow or Trigger.
Data converters can perform several types of functions. The following use cases are only three examples.
- Save only specific fields from each object, or record, to reduce the size an extremely large payload.
- Concatenate two fields into one: for example, concatenate first_name and last_name into full_name.
- Merge several individual objects , or records, into an array.
In the endpoint, two fields make up the converter:
- Data converter: Name of the converter, reference from the Data Converter page
- Converter args: Various arguments, or values, that the converter's function uses when modifying the payload. Many converters do not contain arguments.
Recommendation: Use data converters sparingly. Because they change the original payload from the API before workflow starts, they can make troubleshooting difficult. Also, only edit data converters for your corporate account.
Standard or new converter
A data converter is created for an individual Cloudsnap corporation but can be marked as Public so others can use them as well. A converter can be scoped for one application. Each can be used with more than one endpoint.
Before you create a new data converter, review those that are available to the corporation, either within the corporation itself or public.
Review available data converters
Warning: If the converter is Public (true), udo NOT edit. Other corporations may be using it. Also, if it is not Public (false), make sure that you know all the endpoints that use it.
- Go to the platform, click Advanced Services > Data Converters.
- Choose Edit to review the converter details or edit it.
- Click Delete to remove the converter.
Cloudsnap Data Converters
Choose data converter for endpoint
Note: Review converters on the Data Converter page to understand details for any converter that you use with an endpoint.
- Go to the platform, click Advanced Services > Data Converters.
- Choose Edit to review the converter details or edit it.
- Click Delete to remove the converter.
- Click on the appropriate converter.
- If the code requires arguments, type them in Converter args. (Optional)
- Click the Update Endpoint button.
Available Data Converters for Endpoint
Create data converter
Note: Create a data converter only after you do not find one that meets your requirements on the Data Converter page.
- In the left panel of the Cloudsnap platform, click Advanced Services > Data Converters.
- On the Data Converter page, click the New Data Convert button.
- Define the new converter on the New Data Converter page. Only Name and code are required.
- Check Public to allow other corporations to use the converter.
- Select an App Template if the endpoint only works with a specific template.
- Click the Save button.
The converter, whether Public or not, is listed on the Data Converter page and the drop-down list for an endpoint and trigger.
New Data Converter page
Note: Use @body for the payload and @arg for the arguments.
When you choose and test a Data Converter for an endpoint or a trigger, its JSON response is added to the Response Parameters for the endpoint or trigger.
Comments
0 comments
Article is closed for comments.