Getting Data In

How do you change apps in in the API (Java)?

scottq
New Member

So I am following the Java Splunk API tutorials and Can list apps and saved searches but for the life of me I cannot figure out how to get saved searches per app.

This is what I have but it defaults to the main app and not the app I am trying to look for.

Collection<SavedSearch> savedSearches = service.getApplications().get("a_different_app").getService().getSavedSearches().values();
    for (SavedSearch ss: savedSearches){
        System.out.println(ss.getName());
    }

As you can see I am trying to go to a different app other than the default "Search & Reporting" so I tried that on from this one below.

Collection<SavedSearch> savedSearches = service.getSavedSearches().values();
    for (SavedSearch ss: savedSearches){
        System.out.println(ss.getName());
    }

Both codes above prints out the saved searched for the "Search & Reporting".

Can anyone help with printing the searches from certain apps and then run said search from that app?

Thanks

Tags (2)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...