Is there any way to configure the value of the response?
artefactop opened this issue · comments
Hi,
I would like to use this to mock an external API, my question is I can configure the response, for example:
POST Request with Body {"element_id": 2}
Response {"element_id": 2, "deleted":true}
Where value of element_id match in request and response.
Hi @artefactop,
It depends on what you're looking for:
- If you want to define different responses based on the
element_id
(e.g. if it is2
then return2
anddeleted
equals totrue
; if it is3
then return3
anddeleted
equals tofalse
); the response would be: YES. - If you want to dynamically re-use the
element_id
on the response (e.g. the response should contain theelement_id
value present on the request, without specifying which one), then it's: NO.
You can find some examples in our documentation about how to define dynamic responses based on either regexes or JSON schemas, for instance.
Does that clarify you question?
Thanks!
Yes, thank you. I was looking for the second behavior you explain. 😢