Dashboards & Visualizations

Custom Dashboard panels REST API

strive
Influencer

Hi,

Our requirement is to show dashboard panels created by users on a custom GUI(graphical user interface). We use REST API to fetch the list of custom dashboard panels. The REST API we are using is: "/servicesNS/{arg1}/{arg2}/data/ui/views/{arg3}"

The issue we are facing is: Say a user creates two dashboard panels with same name, but with different access restrictions: one as private and one as public. Only the public are returned by REST API. The private panels are not retrieved. Where as if i login to splunk web, i can see both being listed there. How to solve this bug in REST API.

Thanks

Strive

Tags (2)
1 Solution

nmistry_splunk
Splunk Employee
Splunk Employee

I would use /servicesNS/-/-/data/ui/views?sort_mode=natural&count=25 REST endpoint with appropriate count and offset parameters to get the list of dashboards. If you prefer JSON response use output_mode=json

The response is list of dashboard and for each dashboard there are acl.app and acl.owner attribute, which can tell you the what app does this dashboard belong to and who is the owner.

If you know which user and which app: you can also use search paramater to filter the results. The resulting REST would look something like:

  • all dashboards by admin

    /servicesNS/-/-/data/ui/views?sort_mode=natural&count=25&search=eai%3Aacl.owner%3Dadmin

  • all dashboards by admin within search app

    /servicesNS/-/-/data/ui/views?sort_mode=natural&count=25&search=eai%3Aacl.owner%3Dadmin%20AND%20eai%3Aacl.app=search

View solution in original post

nmistry_splunk
Splunk Employee
Splunk Employee

I would use /servicesNS/-/-/data/ui/views?sort_mode=natural&count=25 REST endpoint with appropriate count and offset parameters to get the list of dashboards. If you prefer JSON response use output_mode=json

The response is list of dashboard and for each dashboard there are acl.app and acl.owner attribute, which can tell you the what app does this dashboard belong to and who is the owner.

If you know which user and which app: you can also use search paramater to filter the results. The resulting REST would look something like:

  • all dashboards by admin

    /servicesNS/-/-/data/ui/views?sort_mode=natural&count=25&search=eai%3Aacl.owner%3Dadmin

  • all dashboards by admin within search app

    /servicesNS/-/-/data/ui/views?sort_mode=natural&count=25&search=eai%3Aacl.owner%3Dadmin%20AND%20eai%3Aacl.app=search

strive
Influencer

Thanks. We did some modifications based on your answer and it worked for us.

0 Karma

AppleMark
New Member

When searching the REST API using curl, I find having curl do the URL encoding is much easier to read:
curl --get --data-urlencode "search=eai:acl.owner=USER_NAME_HERE" https://server:8089/servicesNS/-/-/data/ui/views
(Note that the --get is needed as otherwise --data-urlencode will change the request to a POST.)

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...