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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...