Return Data Tables as JSON in API call

Jeff_146001 Posts: 296 admin

You can return data from Data Tables in an API call by using a Webhook Trigger and the attached template. Steps to configure:

  1. Import the attached template into your Catalytic team.
  2. Add a Webhook Trigger.
  3. Configure as follows:
  • Wait for process to complete: True
  • Do you want to receive a custom response: True
  • Response Content-Type: application/json
  • Response Template: Follow the format below to pass data to your workflow. Note that the mytable value has 3 curly brackets to pass properly formatted JSON.
         "mystring": "{{mystring}}",
         "mytable": {{{mytable}}}

In the body of your API call, include the data-table-id of the table you'd like to return. For example:

         "data-table-id": "11111111-1111-1111-1111-111111111111"

While you could set that value as the default in the Data Table ID field, passing it in the API call enables you to use this workflow for multiple tables.

If you'd like to filter the response, you can send additional fields in the body of the API call, and then use those fields in either of the actions: Tables: Apply filters or Excel: Apply filters.