Dashboards & Visualizations

How to make a web service call from the dashboard?

mohitthapar
New Member

I want to call a web service from the dashboard using post method from the UI. How to define the web service in the app?

Tags (1)
0 Karma

rvany
Communicator

Are you familiar with Splunk SDK or SplunkJS? Is this link http://docs.splunk.com/DocumentationStatic/JavaScriptSDK/1.8.3/splunkjs.Service.Endpoint.html of any help?

0 Karma

sboogaar
Path Finder

The documentation is incorrect. it is not even valid javascript.

0 Karma

renjith_nair
Legend

Hi @mohitthapar,

Probably you have to get the data first in splunk and build dashboard on top of that as mentioned in https://www.splunk.com/blog/2013/06/18/getting-data-from-your-rest-apis-into-splunk.html

Happy Splunking!

niketn
Legend

Agreed, besides REST API Modular input, you can also try the Splunk Add On Builder. You can configure the input to get data through POST (Refer to the documentation http://docs.splunk.com/Documentation/AddonBuilder/latest/UserGuide/ConfigureDataCollection).

Alternatively, you can create your own python script to POST to REST API URL and process the response and ingest to Splunk. http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsBasicExample
On click on a button in UI, you can invoke your Python Script using the script command.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@mohitthapar, could you elaborate on your use case as to what is the trigger condition for POST action and any other details on what you want to send with POST to which REST Endpoint (or is it custom)?

You can create POST Workflow Action on the Raw events based on their eventtype:
https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/SetupaPOSTworkflowaction

Not sure if this is what you need.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

mohitthapar
New Member

Thanks. I want to show the output(Example: Risk Score or something) of rest API call in UI on a button click. On button click that rest API should be called and display the response. So how to define this rest API inside our app.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...