# Help with API scraping

**URL:** <https://discourse.chef.io/t/help-with-api-scraping/18882>\
**Category:** Habitat Help\
**Created:** [October 25, 2018, 4:32am UTC](https://discourse.chef.io/t/help-with-api-scraping/18882 "2018-10-25T04:32:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamessewell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jamessewell/32/2885_2.png) [@jamessewell](https://discourse.chef.io/u/jamessewell)\
**Post date:** [October 25, 2018, 4:32am UTC](https://discourse.chef.io/t/help-with-api-scraping/18882/1 "2018-10-25T04:32:52Z")

</div>

Hi,

I’m trying to use the API for two things:

1. Get the old behavior of `#each` (show all services, not just active ones) for Prometheus (you don’t want nodes to be removed from monitoring / alerting when the supervisor stops on a node)
2. Get some information to feed into Prometheus (hopefully this can go back in-core at some stage)

For the first one I get all the `.service.list.` entries and then remove all the `.departure.list.departure` entries. This works well.

For the second one I’m trying to identify the following:

- total number of supervisors running a service (the service appears in `hab sup status`)

I can’t for the life of me seem to find a way of identifying this.

I can get the list of all services, and I can count the supervisor ids which are listed - but I can’t find a way of identifying supervisors which are **no longer** running the service so I can exclude them.

Am I just looking in the wrong place??

---

<div class="post-metadata">

**Author:** ![jamessewell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jamessewell/32/2885_2.png) [@jamessewell](https://discourse.chef.io/u/jamessewell)\
**Post date:** [October 29, 2018, 11:14pm UTC](https://discourse.chef.io/t/help-with-api-scraping/18882/2 "2018-10-29T23:14:49Z")

</div>

Got this working!

😀

---

<div class="post-metadata">

**Author:** ![jamessewell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jamessewell/32/2885_2.png) [@jamessewell](https://discourse.chef.io/u/jamessewell)\
**Post date:** [October 31, 2018, 2:12am UTC](https://discourse.chef.io/t/help-with-api-scraping/18882/3 "2018-10-31T02:12:03Z")

</div>

Actually not working ☹

Would you expect to be able to locate running services from `/census` or `/butterfly` ?

---

<div class="post-metadata">

**Author:** ![joshb](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/joshb/32/2380_2.png) [@joshb](https://discourse.chef.io/u/joshb)\
**Post date:** [October 31, 2018, 4:03pm UTC](https://discourse.chef.io/t/help-with-api-scraping/18882/4 "2018-10-31T16:03:45Z")

</div>

Does the `/services` endpoint have the information you need?

---

<div class="post-metadata">

**Author:** ![jamessewell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jamessewell/32/2885_2.png) [@jamessewell](https://discourse.chef.io/u/jamessewell)\
**Post date:** [October 31, 2018, 8:12pm UTC](https://discourse.chef.io/t/help-with-api-scraping/18882/5 "2018-10-31T20:12:04Z")

</div>

It does, but then I have to contact all the supervisors individually.

I was under the assumption service state changed was gossiped when I wrote this - I was wrong!
