I have a scenario to mock. (Using only JSON)
Here is the request URLhttps://somhost.com/sometext1/sometext2/12345
Here is my mapping file
{
"uuid" : "f2881f58-9499-372f-be2b-d3602d75f7b2",
"priority": 1,
"request" : {
"urlPattern" : "/sometext1/sometext2/(.*)",
"method" : "GET",
"headers": {
"X-Correlation-Id": {
"equalTo": "proxy_1"
}
}
},
"response" : {
"status" : 200,
"bodyFileName" : "ResponseFile.json",
"transformers": ["response-template"]
}
}
Here is the ResponseFile.json
{
"OrderId":"$$request.path.[2]$$",
"status": "Pending",
"etag": "2f599661db977106441f641e69920378"
}
I want 12345 from my request url into the response body for the JSON tag OrderId. I tried a few combination like the one I gave above $$request.path.[2]$$. But none of them are working. Any help in this regard is much appreciated.