This document defines the usage of the Configureme repository RESTful interface.
General
Request format
Requests to the REST Interface should have the form:
http://server:port/<restpath>
Not all parts of the path must be always present.
Parameter | |
---|---|
server | Name of the server, for example localhost or www.mydomain.com |
port | Port of the server. For example 8088. |
restpath | The specific url for the case. The url is defined in the table below. |
Response format
The response provided as JSON. The response format is defined by Accept header.
- application/json - for JSON
All replies are packed in a general response object.
JSON Example:
{ "success": true, "message": null, "results": { "test2": { "id": "57342838b4c36d4f97ed067d", "name": "test2", "creationTimestamp": 1463035960656, "lastEditTimestamp": 1463035960656, "configurationContext": { "respondTo": "ums_ftp", "sftpSubFolder": "ALL_RESULTS", "responseType": "SHORT", "language": "ENGLISH", "loginNet": "1760" } } } }
The general response object contains at least two fields:
- Status - could the request be processed correctly. If the status is false you should throw away the response.
- Results - a dictionary (hashmap) with result objects. The result objects differ from case to case.
Cases
Section | Case | Case-URL | Method | Parameters | Example URL | Response | |
---|---|---|---|---|---|---|---|
Configurations | |||||||
List all configurations names | /configurations | GET | http://<server>:<port>/configurations | ||||
Get a single configuration | /configurations/{name} | GET |
| http://<server>:<port>/convigurations/test1 | |||
Delete configuration | /configurations/{name} | DELETE |
| http://<server>:<port>/configurations/test1 | none. Example: { "success": true, "message": null, "results": { "test2": "Configuration deleted" } } | Warning, this will actually drop data. | |
Create configuration | /configurations/{name} | POST, PUT | POST/PUT data JSON: { "name": "TestAccumulator", "producerId": "ThreadCount", "interval": "1m", "unit": "MILLISECONDS", "statName": "ThreadCount", "valueName": "current" } | http://<server>:<port>/configurations/test3 | { "success": true, "message": null, "results": { "test3": { "id": "57342ff7b4c36d4f97ed067e", "name": "test3", "creationTimestamp": 1463037943620, "lastEditTimestamp": 1463037943620, "configurationContext": { "name": "TestAccumulator", "producerId": "ThreadCount", "interval": "1m", "unit": "MILLISECONDS", "statName": "ThreadCount", "valueName": "current" } } } } | Note, if the name is already used, it will be replaced. | |
Returns timestamp of last change | /lastChangeTimestamp | GET | http://<server>:<port>/lastChangeTimestamp/test1 | { "success":true,"message":null,"results": { "test1":1462542984843 } } | |||
Return configuration for environment | /configurations/{name}/{environment} | GET | name - configuration name evironment - specified environment | http://<server>:<port>/configurations/test1/test | { "success": true, "results": { "version": { "fileTimestamp": "2015-06-28T00:25:50,000", "version": "2.6.2-SNAPSHOT", "group": "net.anotheria", "artifact": "moskito-webui" } } } |
| |
Import all configurations | /configurations/import | POST,PUT | POST/PUT data JSON: {
| http://<server>:<port>/configurations/import | { "success": true, "message": null, "results": { "importResult": { "amount": 2, "timestamp": 1463392493878 } } } | ||
Import only not imported configurations | /configurations/importNew | POST, PUT | POST/PUT data JSON: { | http://<server>:<port>/configurations/importNew | { "success": true, "message": null, "results": { "importResult": { "amount": 1, "timestamp": 1463392493887 } } } | ||
Export all configuration in one json | /configurations/export | GET | http://<server>:<port>/configurations/export | { "success": true, "message": null, "results": { "configurations": { "import2": { "p11": 3, "p12": "eee" }, "import1": { "p11": 3, "p12": "eee" } } } |