All Apps and Add-ons

How to execute DELETE request via splunk REST api to delete a look up file in Javascript or XML?

Muliang
Engager

Hi all,

I am trying to create a button in the dashboard. By pressing the button, the selected look up file can be removed. I have found one command line (see below) to do this. How can I apply this command line in javascript or dashboard XML file. 

command line:

curl -k -u admin:pass --request DELETE https://localhost:8089/servicesNS/admin/search/data/lookup-table-files/remove_test.csv

 

Thank you!

 

Labels (1)

diogofgm
SplunkTrust
SplunkTrust

You could try to run the rest request in search.

This other answer explains how you can accomplish it using javascript:
https://community.splunk.com/t5/Dashboards-Visualizations/Button-to-run-splunk-query/m-p/454738

But you can't use the default `|rest`command to use http methods other than "GET" so you can use this app that has a more flexible rest command in the search you build:
https://splunkbase.splunk.com/app/2775/

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma

sboogaar
Path Finder

@diogofgm  He asked how to remove a lookup file not how to create it, I dont know of a splunk query to remove a lookup table.

0 Karma

diogofgm
SplunkTrust
SplunkTrust

Yes I understood that. The 1st link I shared explains how to run a search when pressing a button using javascript in a dashboard. The 2nd link its an app that has a more flexible rest command that allows to use other methods other than the "get". So he just needs to setup the new command to "delete" and then use the details from the 1st link to use that command.

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...