RESTful Storage Service
from version 1.5
In order to support the continuous load testing during the continuous integration process, which has become very popular lately, the inspectIT has decided to provide limited storage services via RESTful protocol. This article describes all the provided services in details.
JSON Format
RESTful Storage Service returns all the results in the JSON format.
Services
Invoking Service
All services can be invoked with the HTTP requests. The services are bounded to the IP of the CMR and port that is used for HTTP communication (defaults to 8182). Please see the Port configuration page to confirm the correct port used for the HTTP communication, if the default one has been changed.
The example URL for invoking Get All Storages is:
http://localhost:8182/rest/storage
Overview
Service | Description |
---|---|
Get All Storages | This service returns the list of currently existing storages on the CMR. |
Get One Storage Details | This service returns the details of one existing storage on the CMR. |
Create Storage | This service enables the creation of new storage. The service returns the details of newly created storage. |
Finalize Storage | This service enables the finalization of existing storage. |
Delete Storage | This service enables the deletion of existing storage. |
Get Recording State | This service returns the current recording state. |
Start or Schedule Recording | This service enables that the recording is started or scheduled to be started in the future. |
Stop Recording | This service enables the stop of the recording. |
1. Get All Storages
This service returns the list of currently existing storages on the CMR.
Path: | /rest/storage |
Example URI: | /rest/storage |
Example output: | [ { "id":"648ab3c3-5980-4aa3-96cd-c7d360a3b9e9", "name":"NewStorage", "diskSize":112, "description":null, "cmrVersion":"n/a", "labelList":[ { "id":0, "dateValue":1391605845482, "storageLabelType":{ "id":0, "onePerStorage":true, "editable":false, "valueReusable":false, "multiType":false, "valueClass":"java.util.Date", "groupingEnabled":true }, "value":1391605845482, "formatedValue":"Feb 5, 2014" } ], "state":"OPENED", "storageRecording":false, "storageClosed":false, "storageOpened":true, "storageFolder":"648ab3c3-5980-4aa3-96cd-c7d360a3b9e9" }, { "id":"1383f79c-9a26-440d-a891-8c7956adf1fb", "name":"Ivan's", "diskSize":108, "description":null, "cmrVersion":"n/a", "labelList":[ { "id":0, "dateValue":1391605770264, "storageLabelType":{ "id":0, "onePerStorage":true, "editable":false, "valueReusable":false, "multiType":false, "valueClass":"java.util.Date", "groupingEnabled":true }, "value":1391605770264, "formatedValue":"Feb 5, 2014" } ], "state":"OPENED", "storageRecording":false, "storageClosed":false, "storageOpened":true, "storageFolder":"1383f79c-9a26-440d-a891-8c7956adf1fb" } ] |
2. Get One Storage Details
This service returns the details of one existing storage on the CMR.
Path: | /rest/storage/{id} |
Parameters: |
|
Example URI: | /rest/storage/6d623a4b-e9e4-4fdc-ab3b-c1e89d4c6873 |
Example output: | { "id":"d6dd6e91-541e-495f-9d51-b1728865cd9c", "name":"Created via REST", "diskSize":118, "description":null, "cmrVersion":"n/a", "labelList":[ { "id":0, "dateValue":1391607409138, "storageLabelType":{ "id":0, "onePerStorage":true, "editable":false, "valueReusable":false, "multiType":false, "valueClass":"java.util.Date", "groupingEnabled":true }, "value":1391607409138, "formatedValue":"Feb 5, 2014" } ], "state":"OPENED", "storageRecording":false, "storageClosed":false, "storageOpened":true, "storageFolder":"d6dd6e91-541e-495f-9d51-b1728865cd9c" } Â |
3. Create Storage
This service enables the creation of new storage. The service returns the details of newly created storage.
Path: | /rest/storage/{name}/create |
Parameters: |
|
Example URI: | /rest/storage/Created%20via%20REST/create |
Example output: | { "message":"Storage successfully created.", "storage":{ "id":"d6dd6e91-541e-495f-9d51-b1728865cd9c", "name":"Created via REST", "diskSize":0, "description":null, "cmrVersion":"n/a", "labelList":[ { "id":0, "dateValue":1391607409138, "storageLabelType":{ "id":0, "onePerStorage":true, "editable":false, "valueReusable":false, "multiType":false, "valueClass":"java.util.Date", "groupingEnabled":true }, "value":1391607409138, "formatedValue":"Feb 5, 2014" } ], "state":"OPENED", "storageRecording":false, "storageClosed":false, "storageOpened":true, "storageFolder":"d6dd6e91-541e-495f-9d51-b1728865cd9c" } } |
4. Finalize Storage
This service enables the finalization of existing storage.
Path: | /rest/storage/{id}/finalize |
Parameters: |
|
Example URI: | /rest/storage/d6dd6e91-541e-495f-9d51-b1728865cd9c/finalize |
Example output: | { "message":"Storage id d6dd6e91-541e-495f-9d51-b1728865cd9c successfully finalized." } |
5. Delete Storage
This service enables the deletion of existing storage.
Path: | /rest/storage/{id}/delete |
Parameters: |
|
Example URI: | /rest/storage/d6dd6e91-541e-495f-9d51-b1728865cd9c/delete |
Example output: | { "message":"Storage id d6dd6e91-541e-495f-9d51-b1728865cd9c successfully deleted." } |
6. Get Recording State
This service returns the current recording state. Output is in map format containing the current state (ON, OFF or SCHEDULED) as well as additional information based on the current state.
Path: | /rest/storage/state |
Example URI: | /rest/storage/state |
Example output: | { "recordingStatus":"OFF" } |
7. Start or Schedule Recording
This service enables that the recording is started or scheduled to be started in the future. User are advised to first read Recording page for basic information.
Path: | /rest/storage/start |
Parameters: |
|
Example URI: | /rest/storage/start?id=6d623a4b-e9e4-4fdc-ab3b-c1e89d4c6873&startDelay=60000&extractInvocations=false&autoFinalize=true |
Example output: | { "message":"Recording scheduled.", "recordingStorage":{ "id":"82f184b5-5e04-473f-9917-372b71104238", "name":"NewStorage", "diskSize":112, "description":null, "cmrVersion":"n/a", "labelList":[ { "id":0, "dateValue":1391607347073, "storageLabelType":{ "id":0, "onePerStorage":true, "editable":false, "valueReusable":false, "multiType":false, "valueClass":"java.util.Date", "groupingEnabled":true }, "value":1391607347073, "formatedValue":"Feb 5, 2014" } ], "state":"RECORDING", "storageRecording":true, "storageClosed":false, "storageOpened":true, "storageFolder":"82f184b5-5e04-473f-9917-372b71104238" } } |
Starting or scheduling the recording must provide the ID of the existing storage that is in writable state (not closed).
If a parameter value passed can not be correctly converted from String to the correct type, the TypeMismatchException will be thrown:
{"error":"Failed to convert value of type 'java.lang.String' to required type 'java.lang.Boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [trueasdad]","exceptionType":"org.springframework.beans.TypeMismatchException"}
8. Stop Recording
This service enables the stop of the recording.
Path: | /rest/storage/stop |
Example URI: | /rest/storage/stop |
Example output: | {"message":"Recording stopped."} |
Exception Handling
If any call to the provided services results in an exception, the JSON output that will be returned will mark call as error providing the additional information on the exception:
{ "error" : "Recording is already active/scheduled with different storage. Only one storage at time can be choosen as recording destination.", "exceptionType" : "info.novatec.inspectit.storage.StorageException" }