Something that I’ve done to handle this scenario is just to change the url the request is hitting via the prerequest script. Let’s take an example.
Say you don’t want to execute the request when
gadget_id is null. You could do something like this in your prerequest script;
const gadgetId = pm.iterationData.get('gadget_id');
pm.request.url = 'https://postman-echo.com/delay/0';
pm.request.method = 'GET';
// If you need to do any other preprocessing if gadget_id exists
This will still execute a request, but instead of hitting your API, it will hit the postman echo api.
Since you don’t want tests to run (because your api didn’t actually run), you’d want to add this to your tests tab:
const skip = pm.variables.get('skip');
// all of your tests for your API
Essentially you’re just putting your tests behind an if statement to make sure they aren’t run if you ‘skipped’ the request.
Does this all make sense?