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!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...