Payload is undefined once pass to API

Hi

I set rules to trigger http server by passing payload from SQL below

select 
payload.direction as d
from testapi/liveness

and set body to

{
  "result": {$d}
}

but inside API is shown as undefined. what am I missing?

BTW, I try to pass parameter into the URL too but can get only hard code like
www.mockurl.com/api/{$d}
the value from console.log is “{$d}”, not direction value inside payload

Hello

To fix the issue with the undefined payload in your API, ensure the variable interpolation syntax is correct. Check below-

SQL Rule :

SELECT payload.direction AS d

FROM “testapi/liveness”

Body and URL : Ensure you use the correct templating syntax supported by your rule engine:

{

“result”: “${d}”

}

For the URL:

www.mockurl.com/api/${d}

Check your rule engine’s documentation for the correct syntax for variable substitution.

Thank you :slightly_smiling_face:
nathaniel