Retrieving and/or Modifying the configuration via REST
Starting with version 2.2.0, it is possible to retrieve and/or modify the app's configuration via REST.
Supported are:
Retrieving the configuration
Overriding an existing configuration with a new configuration (if valid)
Replacing the current configuration with a new empty configuration
Changing parts of the configuration
For any of the operations, you must be an administrator.
Please also remember the AWS load balancer may block requests.
The base path for any REST requests is
- <base-url>/rest/de.resolution.albauth/1.0/config
Replace <base-url> with the actual base URL of your system.
Retrieve the configuration
GET
- <base-url>/rest/de.resolution.albauth/1.0/config
Returns the current configuration as JSON.
curl command
- curl -v -u admin:password GET https://<base-url>/rest/de.resolution.albauth/1.0/config
Override an existing configuration
PUT
- <base-url>/rest/de.resolution.albauth/1.0/config
Needs the new configuration as a JSON.
Returns 200 if the new config was applied.
curl command
- curl -v -u user:password -d '<JSON String of new config>' PUT https://<base-url>/rest/de.resolution.albauth/1.0/config --header "Content-Type: application/json"
Delete an existing configuration
DELETE
- <base-url>/rest/de.resolution.albauth/1.0/config
Returns 200 if the existing configuration was deleted and replaced with an empty configuration.
curl command
- curl -v -u admin:password DELETE https://<base-url>/rest/de.resolution.albauth/1.0/config
Patch an existing configuration with a PATCH request
The patch endpoint supports application/merge-patch+json or application/json-patch+json.
The type must be specified by setting the Content-Type to one of the two.
Depending on the change, you might prefer one of the two. A merge-patch allows specifying the configuration item and the new value which is an easy solution to e.g. replace the userNameClaim with a new value.
However, changing an array entry in the configuration with a merge-patch means fully specifying all the array entries, not only the one you want to change.
In the case of working with an array in the configuration, a json-patch is handier: it allows you to specify the direct path to the configuration item you want to change.
E.g., see the following array. The task is to replace "choco" with "chocolate" :
- {
- "cake": [
- { "name": "fruit" },
- { "name": "choco" }
- ]
- }
Patching the config with a merge-patch would mean you add the whole array with the REST request. With a json-patch you can specify the path:
{ "op": "replace", "path": "/cake/1", "value": { "name": "chocolate" } }
and ignore the other entries.
merge-patch+json
PATCH
- <base-url>/rest/de.resolution.albauth/1.0/config
Content-Type: application/merge-patch+json
Needs a JSON that specifies the content item to change and the new value, e.g.
- {
- "userNameClaim" : "newClaimName"
- }
Returns 200 if everything went well
curl command
- curl -v -u user:password -d '{"userNameClaim" : "newClaimName"}' PUT https://<base-url>/rest/de.resolution.albauth/1.0/config --header "Content-Type: application/merge-patch+json"
json-patch+json
PATCH
- <base-url>/rest/de.resolution.albauth/1.0/config
Content-Type: application/json-patch+json
Needs a JSON that specifies the change in JSON Patch format, e.g.
- [
- {
- "op" : "replace",
- "path": "/userNameClaim",
- "value" : "newClaimName"
- }
- ]
Returns 200 if everything went well
curl command
- curl -v -u user:password -d '[{"op" : "replace", "path": "/userNameClaim", "value" : "newClaimName"}]' PUT https://<base-url>/rest/de.resolution.albauth/1.0/config --header "Content-Type: application/json-patch+json"