Process a request and respond with a "dynamic" JSON

Hi,
I wish to allow an external app for querying my module.
To simplify it a bit: the module contains data like customer ID, sold item, date. There are multiple rows per customer ID and I would like to be able to send a request with the Customer ID and in response get a JSON with matching rows.

I understand the idea of processing an HTTP request within a workflow, but I have no idea how to attach a dynamic JSON to the “Postfiltering” → “JSON Response”. To me, it looks like I can only pass there a static value.

To be honest I admire you all for working with such limited documentation :slight_smile: Is there any other hidden place where I can find any information on how to perform such tasks?

1 Like

Can you use the built-in record search endpoint? The response is a JSON; you can use this cURL

curl "$BASE_URL/api/compose/namespace/$NAMESPACE_ID/module/$MODULE_ID/record/?query=0&limit=20" \
  -H 'Accept: application/json, text/plain, */*' \
  -H "Authorization: Bearer $JWT" \
  --compressed

The integration gateway doesn’t currently support much response manipulation – this will be improved (most likely) in the 2022.9 release.

The docs are here and the repo is here. Suggestions for improvements/contributions are always welcome

3 Likes

Thank you very much for your help. I have a few projects in my pipeline that I wish to build based on Corteza, so I hope that soon I will be able to help with docs :wink:

1 Like

@tjerman ,

Any update on adding the ability to send dyamic responses from application gateway?

@shmuel ,

the gateway responses have been implemented in the Release 2023.3.0-dev.2 · cortezaproject/corteza · GitHub.

The way to use it is to enable the Response postfilter on the route and use the inputs just like you would use the expressions in Workflows.
The documentation is ofcourse in the works and coming soon (I promise).

@peter ,

Great, can’t wait!

Two questions.

  1. Will be be able to access the output of workflow processers in the Response postfilter?
  2. When will a release candidate for 2023.3 be available?

Hi @shmuel,

  1. Yes, the main point of the Response postfilter is the integration with workflows and I have tried to accommodate as many scenarios as possible.
  2. Around end of march (fluid :slight_smile: )
1 Like