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!

What’s New in Splunk Cloud Platform 9.1.2308?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2308! Analysts can ...

Index This | Why do they call it hyper text?

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

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...