Reputation: 320
What should be the mapping object if 1) I need to pass my query 2) the query should be used to send one object out of an array of objects
curl -X POST --data '
{ "request":
{ "url": "/jsons?id=someID", "method": "GET" },
"response":
{ "status": 200, "jsonBody": {"objs":[{"id":"1","name":"abc"},{"id":"2","name":"cde"
{"id":"someID","name":"efg"}]}}}
'http://localhost:8080/__admin/mappings/new
I want the above url to return just {"id":"someID","name":"efg"}
How should i change the above mapping to get the desired output
Upvotes: 1
Views: 196
Reputation: 365
The response should have one object for that particular get request with query param and not array of objects.
For your example it should be something like this
curl -X POST --data '
{ "request":
{ "url": "/jsons?id=someID", "method": "GET" },
"response":
{ "status": 200, "jsonBody": {"objs": {"id":"someID","name":"efg"}}}}
'http://localhost:8080/__admin/mappings/new
Upvotes: 1