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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...