All Apps and Add-ons

DBConnect: How to Edit DB Connections via REST API?

vbatra
Observer

I am using the REST API knowledge in - https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-V3-Automated-Programmatic-cre...

But I am not able to update a DB connection. Is there a way to update it without having to delete it? My end goal is to update an identity, but for that, I am thinking if updating the db connection to point to another identity, then deleting the original identity, then creating a new one, and pointing my db connection to it via REST API.

Labels (2)
0 Karma

bazman
Observer

The solution that I found for this is to use the PUT method instead of a POST and to go to the endpoint specific to the connection.

For example to change "myparam":

 

curl -k -X PUT -u "admin":"changeit" --url https://localhost:8089/servicesNS/nobody/splunk_app_db_connect/db_connect/dbxproxy/connections/myconnection -d "{\"name\":\"myconnection\",\"identity\":\"myid\",\"connection_type\":\"mytype\",\"myparam\":\"new_value\"}"

 

 "myconnection" being the name of the connection you want to modify. 

You have to put the name, identity and connection_type parameters otherwise it will throw an error. Also you cannot modify them.

It also works for editing Identities and this time you have to put the name and username parameters : 

 

curl -k -X PUT -u "admin":"changeit" --url https://localhost:8089/servicesNS/nobody/splunk_app_db_connect/db_connect/dbxproxy/identities/myidentity -d "{\"name\":\"myidentity\",\"username\":\"myuser\",\"myparam\":\"new_value\"}"

 

Again, "myidentity" being the name of the identity.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...