Q: Return dynamic API response in a browser #1152
Replies: 1 comment
-
It is currently not possible to directly share rule execution metadata between separate rules. But there are some ways of achieving this depending on the type of service that you have and the nature of your app: Approach 1: Make the request to service Y yourselfAssumption: Service Y is assumed to always be called, and Y is idempotent (meaning results from the API do not change when the same request is made again)in that case you can apply a rule on the call to service X, inside which you can make the request to Y and modify the response from X accordingly. Here's a sample rule Approach 2: share state between rule execution by saving state in window object.Assumption 1: Call for service Y is made before any calls to service XNote: This works only on the extension, not the desktop appCurrently when programmatically modifying the response, the status code is not being passed inside the arguments of modification code. This should be easy to add and I have raised an issue for this. Meanwhile if you have any extra parameters indicating the response was succesfull (for eg, by analyzing the response body), you can set a variable inside the window object, like Then inside the rule for X check if Here are sample rules for these: |
Beta Was this translation helpful? Give feedback.
-
Question:
Can you give an example that how can I use Dynamic response by writing javascript method?
This is my need => i have two services , they are X and Y.
I want if Y services call and gives 200, make X reponse an area false. If not ,make ture.
Can you give an example?
Asked by: identity_hidden
Beta Was this translation helpful? Give feedback.
All reactions