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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...