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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...