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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...