# Comparing different statuses in Postman

**URL:** <https://community.postman.com/t/comparing-different-statuses-in-postman/27203>\
**Category:** Help Hub\
**Created:** [August 27, 2021, 5:17am UTC](https://community.postman.com/t/comparing-different-statuses-in-postman/27203 "2021-08-27T05:17:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mission-architect-43](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mission-architect-43](https://community.postman.com/u/mission-architect-43)\
**Post date:** [August 27, 2021, 5:17am UTC](https://community.postman.com/t/comparing-different-statuses-in-postman/27203/1 "2021-08-27T05:17:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmnazario](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cmnazario/32/10207_2.png) [@cmnazario](https://community.postman.com/u/cmnazario)\
**Post date:** [August 27, 2021, 1:33pm UTC](https://community.postman.com/t/comparing-different-statuses-in-postman/27203/2 "2021-08-27T13:33:17Z")

</div>

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

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

    You can also put asserts in here

Example:
    pm.test("Validar status 200", function () {
        pm.response.to.have.status(200);
    });

}

```

Hope this helps 😉

---

<div class="post-metadata">

**Author:** ![mission-architect-43](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mission-architect-43](https://community.postman.com/u/mission-architect-43)\
**Post date:** [September 7, 2021, 5:09pm UTC](https://community.postman.com/t/comparing-different-statuses-in-postman/27203/3 "2021-09-07T17:09:22Z")

</div>

Yes it worked great!! Thanks
