Configuring DB Service Using system API

I am trying to access & configure the ‘database’ parameter of a postgresql service using GET/PATCH and unable to do either.

works and results in a full list of fields and values like below

{“id”:20,“name”:“servicename”,“label”:“PostgresDB”,“description”:“Postgres Database”,“is_active”:true,“type”:“pgsql”,“mutable”:true,

also works

However, retrieving ONLY the config or the ‘database’ value within the config is not working.

Any inputs on retrieving and also modifying the ‘database’ value much appreciated.
Thanks much!

Hello, tabraham. What exactly do you mean, retrieving only the config or the config.database value is not working? I am able to retrieve these values using any number of methods. What specifically are you trying to do to retrieve these values that is not working?

Unless you are talking about the built-in API Docs feature, which I have found to be quite buggy at times…?


Also, just as a warning, not all of the data you see there will be retrieved by specifying it in the “fields” paramter, as this data is pulled from multiple places. For instance, I have a SQL database where most of the details are not configured in the dbo.service table, but in the dbo.sql_db_config table. So, my thought is this is why you are having the issues you are, if you are trying to specify specific details within the “fields” parameter via an API call. You are going to need to parse out what you want from the other response, I believe, as it is building its API call against only the dbo.service table by default.



Thanks Paul. In terms of intent - I was hoping to a) just retrieve the config:database value – and not the entire list of fields and b) update only the config:database parameter for a postgresql service.

In the end, decided it was not a big issue to retrieve the entire list and then just parse the database parameter (similar to suggestion in your second response). I was also able to make the PATCH work by creating a json payload with only config:database.

Thanks again.

1 Like