Comparing different statuses in Postman

Hi All,

I am running a postman code to create a functionality for a particular page. The page works fine when the user has access to create a functionality but when he doesn’t have the rights he gets an 403 forbidden error.

I am trying to create a condition where it shall compare the status and then proceed with either getting success status for creating an user or forbidden status for not being able to create one

Note - I have 2 users and will run the iterations twice.
User 1 has access to create user and User 2 does not have access to create an user

Hello @mission-architect-43
If I understand correctly I think you can perform a condition by checking the code:

if(pm.response.code === 200) {
    your code here

    You can also put asserts in here

    pm.test("Validar status 200", function () {;


Hope this helps :wink:

1 Like

Yes it worked great!! Thanks

1 Like