Advanced mock based on JSON Body

I think I understand. will try and get back to you tomorrow. is my script correct?

The script seems to be correct. To further isolate the issue, try setting the response JSON with the intermediate variable or directly with the specific value you are interested in.

so. I think I know what I need.
I need an example JSON, (not a mocked one from a generator, one that I can paste from an JSON example) and then use the mocking script to switch some values I need from the request in the response.

if I do not use expectations, I do always only get the generated mocked values, which is not right by me. how can I achieve this?

thanks

The Mock Script feature is off by default. Have you tried enabling it?


yes.but that one does not work,when expectations are fullfilled. with expectation,I can send a static response,and modify its values with the script. but the script does not trigger,as the expectation matched. if I do not met the expectation, I get the faker generated response…

with that one value modified with the script if it works…

but all the other values are lore ipsum…

should this settings not do what I need?


that the Expectation Mock ist taken, and the response from this Moc is than modified with the script?

Could you please invite me to your project as a guest so I can view the details? You can send the invitation link via private message on Discord.

I am afraid I can not do that. it is a company project

What I expect is:

  1. Rule in the Mock Expectation will match and give me the static response I prepared
  2. Mock script will awake and modify 1 value from the 1) to match the value from the Request

(I am having a meeting in 10 minutes, so I will come back to you later) but you should be able to advice me from this description. or?

If an Advanced Mock expectation is fulfilled, the Custom Mock script will not be executed.

I see. tried it and sadly it does not work that way. would it be possible,that you can modify apidog, so that each Advanced Mock, which fullfills Expectation its own Mock Script has?

that would help emensly

or an option by scripting, which script belongs to which mock…

I understand the feature isn’t currently working as you anticipated. I’ll be sure to submit a feature request to our product team for their review.