Dashboards & Visualizations

how to retrieve saved search properties via javascript?

RiccardoV
Communicator

Hi,
i'm writing a SimpleXML dashboard and i want to print some properties of a saved search that I have in my app.

I import a javascript file in my dashboard that create a new savedsearchmanager:

var mySavedSearch = new SavedSearchManager({
    id: "example-saved-report",
        searchname: "savedsearch_name",
        app: "myapp"
});

and it works fine, if I print the object in the js console I can see all the information:

console.log(mySavedSearch);

But I am not able to find two basic informations that I need:

1) is the saved search enabled or disabled? - (in the savedsearches.conf file I have disabled = 1, I want to retrieve that value)

2) How is the search scheduled? - (in the savedsearches.conf file I have cron_schedule = 0 */12 * * *, I want to retrieve that value)

1 Solution

RiccardoV
Communicator

create a searchmanager with a call to the rest api:

| rest /servicesNS/user/app_name/properties/savedsearches/saved_search_name/cron_schedule | append [ | rest /servicesNS/user/app_name/properties/savedsearches/saved_search_name/disabled ]

and it will return the two results I need

View solution in original post

RiccardoV
Communicator

create a searchmanager with a call to the rest api:

| rest /servicesNS/user/app_name/properties/savedsearches/saved_search_name/cron_schedule | append [ | rest /servicesNS/user/app_name/properties/savedsearches/saved_search_name/disabled ]

and it will return the two results I need

cgaete
Explorer

Can I modify the properties or do CRUD using the REST API?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...