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!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...