# IP-Filtering API not showing rulesets

**URL:** <https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644>\
**Category:** Elastic Cloud Enterprise (ECE)\
**Created:** [October 29, 2019, 10:36am UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644 "2019-10-29T10:36:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![logger](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@logger](https://discuss.elastic.co/u/logger)\
**Post date:** [October 29, 2019, 10:36am UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/1 "2019-10-29T10:36:53Z")

</div>

Hi there,

I am currently trying to script a few things for our ECE.  
Right now I am hurdling with the API for IP-filtering.

> curl -k -X GET -H "Authorization: Bearer mytoken" [https://localhost:12443/api/v1/deployments/ip-filtering/rulesets](https://localhost:12443/api/v1/deployments/ip-filtering/rulesets)  
> {  
> "rulesets": [\*]  
> }

I have a few rulesets created via the UI and I am able to put it manually to the deployments. But I need to script it. Is there a bug or am I doing it wrong.

Greetings  
Malte

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [October 29, 2019, 4:34pm UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/2 "2019-10-29T16:34:53Z")

</div>

Hi @logger

in your example, that `-X GET` should be `-X POST` I think?

If that fails, can you show exactly what call you made and what the API replied (use ``` to avoid getting crazy markdown artefacts in your code!)

Alex

---

<div class="post-metadata">

**Author:** ![logger](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@logger](https://discuss.elastic.co/u/logger)\
**Post date:** [October 29, 2019, 4:44pm UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/3 "2019-10-29T16:44:15Z")

</div>

Hi  
I used [https://www.elastic.co/guide/en/cloud-enterprise/current/ece-filter-ip-traffic.html#ece-filter-ip-traffic](https://www.elastic.co/guide/en/cloud-enterprise/current/ece-filter-ip-traffic.html#ece-filter-ip-traffic) for the example.

`curl -X GET -u USERNAME:PASSWORD https://ECE_HOST:12433/api/v1/deployments/ip-filtering/rulesets`

instead of username and Password I first created a token. And a wrong port is given in the docs I think. shouldn´t it be 12443 not 12433?

and the Response to `curl -X GET -u USERNAME:PASSWORD https://ECE_HOST:12433/api/v1/deployments/ip-filtering/rulesets`  
is

```auto
{
  "rulesets": []
}

```

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [October 29, 2019, 5:32pm UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/4 "2019-10-29T17:32:03Z")

</div>

Apologies I misread the first post and thought you were trying to write to that endpoint, my bad.

We're looking into it now (and yes 12443 is correct, that's a typo in the docs, thanks for pointing out)

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [October 29, 2019, 6:25pm UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/5 "2019-10-29T18:25:32Z")

</div>

Did you say the UI was showing the rulesets?

If so, navigate to the `/region/ece-region/security` page, and bring up the network console in the browser.

You should see a call like `/api/v1/regions/ece-region/deployments/ip-filtering/rulesets?include_associations=true`

Try `curl`ing that from the command line? If that works, try removing `include_associations`. Are you the same user when logging in via the UI as you are from the API?

---

<div class="post-metadata">

**Author:** ![logger](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@logger](https://discuss.elastic.co/u/logger)\
**Post date:** [October 30, 2019, 6:42am UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/6 "2019-10-30T06:42:53Z")

</div>

> [@Alex\_Piggott](#):
>
> Are you the same user when logging in via the UI as you are from the API?

This is it. I was logged in as my private user but tried to curl with the admin user.

My user is in the platform-admin role. Why are the rulesets not visible for other admins?

If I try curling with my user I get  
`{"errors":[{"code":"root.unauthenticated","message":"The supplied authentication is invalid"}]}`  
I double checked my username and password. It is working in the UI but not with curl.

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [October 31, 2019, 7:26pm UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/7 "2019-10-31T19:26:11Z")

</div>

Sounds like a bug, I'm going to raise it internally. Can you use the same user as a workaround in the meantime

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 14, 2019, 7:26pm UTC](https://discuss.elastic.co/t/ip-filtering-api-not-showing-rulesets/205644/8 "2019-11-14T19:26:16Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
