I have an API that can response with 200 or with 204 depending if I have data of an endpoint or not. when the API respond 200 the data action works perfect, but when the API respond 204 I can't do that data action works.
Configuration Response:
{
"translationMap": {
"string": "$.data"
},
"translationMapDefaults": {
"string": "\"error\""
},
"successTemplate": "{\n \"string\": ${string} \n }"
}
If I use the default configuration response...
{
"translationMap": {},
"translationMapDefaults": {},
"successTemplate": "${rawResult}"
}
...Data action test works, and in the step 9 (Resolve translation map), I can see that rawResults is null (204 No Content)
{
"rawResult": "null"
}
Is there any way I can get a default value from a data action when the API response is 204 and the body is empty (null), but keeping the result I get with the API response being 200?
I have tried velocity too, but when the body of the response is empty and I use "translationMap" or "translationMapDefaults" the data action fails.