# Running monitor to check API availability - Testing

**URL:** <https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833>\
**Category:** Help Hub\
**Created:** [June 1, 2022, 12:16pm UTC](https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833 "2022-06-01T12:16:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![automationtester2496](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@automationtester2496](https://community.postman.com/u/automationtester2496)\
**Post date:** [June 1, 2022, 12:16pm UTC](https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833/1 "2022-06-01T12:16:02Z")

</div>

I have a basic test in my collection to check if the API returns a “Status code is 200”. When I run this via the collection it passes. But when I run it via the monitor it fails with the following error. Any thoughts?

```auto
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

```

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/0/02b7ba8904f9c42ca366d69277ce07cf3150f167.png)

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [June 2, 2022, 12:12am UTC](https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833/2 "2022-06-02T00:12:14Z")

</div>

Hello @automationtester2496,

It seems like you have few more tests other than the Status code validation and those test cases are failing.

---

<div class="post-metadata">

**Author:** ![automationtester2496](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@automationtester2496](https://community.postman.com/u/automationtester2496)\
**Post date:** [June 2, 2022, 12:47pm UTC](https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833/3 "2022-06-02T12:47:33Z")

</div>

Removed the extra test still failing any thoughts?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/b/2/b2f7638bc2aecb3c5c061bd2fe4008e4435841e1.png)

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [June 3, 2022, 12:55pm UTC](https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833/4 "2022-06-03T12:55:34Z")

</div>

Could it be that you are following a redirect?  
This is an option when setting up monitors (not sure how it works as i’ve not used it, but a redirect is a 201 code i believe)

![image](https://us1.discourse-cdn.com/getpostman/original/3X/f/5/f5bd31bb5a32f5b7ddcb5ac407a4a57e7d1af20c.png)

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [June 3, 2022, 1:00pm UTC](https://community.postman.com/t/running-monitor-to-check-api-availability-testing/35833/5 "2022-06-03T13:00:27Z")

</div>

Ignore the above suggestion, i just tried it and it outputs a different message;

Example;

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/a/0af4d0a7195a193cbb620fdeadabb09ee2337b27.png)

Could you screenshot your call, including the pre-req and test tabs?
