Dmitriy Advolodkin
11/07/2023, 4:37 PMLee Turner
11/07/2023, 6:14 PMq
parameter is valid json. You could parse the q
parameter value and reference the g
and s
values directly so it won’t matter what order they are in.{
"name": "query-parameter-parsing",
"priority": 1,
"request": {
"urlPattern": "/apq/getStoreItem/storeExecutionItemInfoV3\\?q=(.*)",
"method": "GET"
},
"response": {
"status": 200,
"bodyFileName": "query-parameter-parsing.json",
"headers": {
"Content-Type": "application/json"
},
"transformers": [
"response-template"
]
}
}
{{#parseJson 'parsedObj'}} {{request.query.q}} {{/parseJson}}
{
"g": "{{parsedObj.[0].g}}"
"s": "{{parsedObj.[0].s}}"
}
<http://localhost:8080/apq/getStoreItem/storeExecutionItemInfoV3?q=[{>"c":"US","g":"806594766724","t":"GTIN14","s":"2473"}]
{
"g": "806594766724"
"s": "2473"
}