Dashboards & Visualizations

Custom Dashboard panels REST API

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

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

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

Influencer

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

0 Karma

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