Getting Data In

How can I create a search via the REST API in a specific app?

ericturpin
Engager

I am trying to perform a search to modify a lookup csv via the REST API.

The simple search
|inputlookup filename.csv

when performed via the Web UI the URL for the search would be
https://mysplunk.com/en-US/app/custom_app_name/search?q=%7Cinputlookup%filename.csv

However, I cannot figure out how to target custom_app_name when creating a search via the API. In the past I've created searches against the search app with a POST request to the URL
https://mysplunk.com:8089/services/search/jobs?output_mode=json

Can anyone help me understand what the base URL should look like for interacting with searches performed against custom_app_name?

Thanks!

Tags (3)
0 Karma
1 Solution

ericturpin
Engager

I tried the solution suggested by @somesoni2 and didn't have any success. But the term namespace in my searching helped me find the solution here: https://answers.splunk.com/answers/316/rest-api-with-namespace.html#answer-323

So my POST should go to

https://mysplunk.com:8089/servicesNS/MY_USERNAME/custom_app_name/search/jobs

View solution in original post

0 Karma

ericturpin
Engager

I tried the solution suggested by @somesoni2 and didn't have any success. But the term namespace in my searching helped me find the solution here: https://answers.splunk.com/answers/316/rest-api-with-namespace.html#answer-323

So my POST should go to

https://mysplunk.com:8089/servicesNS/MY_USERNAME/custom_app_name/search/jobs

0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@ericturpin - Glad you were able to find the solution you were looking for. Please don't forget to click "Accept" below your answer in order to resolve your post so others can easily find it. Thank you.

0 Karma

somesoni2
Revered Legend

I believe you need to pass namespace request parameters in your POST job. The base URL should stay the same.

http://docs.splunk.com/Documentation/Splunk/6.2.6/RESTREF/RESTsearch#POST_search.2Fjobs_method_detai...

Name    namespace   
Type    String      
Default 
Description       The application namespace in which to restrict searches.
The namespace corresponds to the identifier recognized in the /services/apps/local endpoint.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...