vendredi 27 août 2021

How to use conditional statement in Postman Body section

I have a scenario to validate multiple datasets with the same logic. Only change is dataset location.

Eg:

Apple, Sony, MI are the datasets, their data is placed in separate folder. If I pass the variable name as Apple, then in postman body part it should check which data to pass.

Body Section in Postman using JSON

   {
    "if" : {  : "Apple"},
    "then" : {"location"},
    "else":
    {
     "if" : {  : "Sony"},
     "then" : {"location"}
    }
  }

If I use the above code, I got the response as Undefined and 200 OK

My expected response should be some ID value (eg: 1,2,3 etc.)

Aucun commentaire:

Enregistrer un commentaire