Hide empty variable in request link

I have this request link with different variable. Some set of parameters will require variable “camera”, but sometime, variable “camera” is not required.
The above example is that i dont need the variable “camera”, if the variable “camera” is removed, it will return 200.

Is it possible to remove the “camera” in request link based on some condition for example, if camera=“”, then the request link will become …/project_id=[440]&sensor_id=[1134,1135,1136,1137]&merge_id=&dashboardURL=&dashboard_title=&start=2022-07-25%2000:00:00&end=2022-07-26%2000:00:00

instead of

thank you

i found out that pm.request.url.query.remove() can acutally do this.
However i do not know to how to access Path Variable’s “description” in the pre-request script…
pm.request.url.query.all() only return key-value but not “description”.

The reason i am doing this is because i want to know if the parameters is required or not

Hi @nickychengv, Why do you need to return the description? Descriptions are blank in your screenshot.

I don’t know the exact syntax, but you could try something like this (depending on your conditional statement);



Some more info on this thread;

Also, be aware of this…


Thus, you can’t access it as part of the request/response.