-
Notifications
You must be signed in to change notification settings - Fork 30
Configuration API
carabalb edited this page May 26, 2021
·
16 revisions
The configuration service acts as a central repository for all runtime configuration parameter. The configuration service is currently an XML backed REST API returning JSON.
Intent | Call | Request Type |
---|---|---|
Set a Configuration Value |
/api/config/(component)/(key)/set
|
POST |
Get all stored values |
/api/config/list
|
GET |
Get all stored values by component |
/api/config/(component)/list
|
GET |
Get a stored value by component, key |
/api/config/(component)/(key)/get
|
GET |
Delete a stored value by component, key |
/api/config/(component)/(key)/delete
|
GET |
====For "Get" calls====( example from http://tdm.dev.obanyc.com/api/config/tdm/list ) :
{ "status":"OK","message-text":null, "config": [ { "component":"tdm", "key":"tdm.crewAssignmentRefreshInterval", "value":"500", "units":null, "value-type":"String", "description":null, "updated":"2013-08-13T10:15:38-04:00" }, { "component":"tdm", "key":"tdm.vehicleAssignmentRefreshInterval", "value":"900", "units":null, "value-type":"String", "description":null, "updated":"2013-04-30T12:08:43-04:00" } ] }
To modify the value for "tdm.crewAssignmentRefreshInterval" from the command line, insert:
curl -X POST -d @file2468 http://tdm.dev.obanyc.com/api/config/tdm/tdm.crewAssignmentRefreshInterval/set --header "Content-Type:application/json"
where the sample file (file2468) may contain the following change in config value:
{"config":{"value":"800"}}
Another example for setting "tds.timePredictionQueueHost" to "queue.dev.obanyc.com":
curl -X POST -d @file3647 http://tdm.dev.obanyc.com/api/config/tds/tds.timePredictionQueueHost/set --header "Content-Type:application/json"
where the sample file (file3647) contains:
{"config":{"value":"queue.dev.obanyc.com"}}
- Value is the only required field in the content of the set post. If others are omitted they will be set as null, or String in the case of valuetype.
- Although component and key may be included in the content, they will be overwritten by the values included in the URL.
- Only String values are supported at the moment, and in fact anything passed in a way other than string will simply be saved as a string.