Testing the connection with method Echo
Info
Each service implemented in the Mercury DB (HgDB) 3.0 system contains the echo
method (a request sent using the POST method). It allows for verifying the correctness of the defined communication between the client and the server. An example of using the method is the implementation of the data source for the Grafana system: datasource.ts where the testDatasource()
method uses the echo method call of the CaseSearchRest
service.
echo​
A method for testing the connection.
Method request​
The table below describes the individual components of the request sent to the echo
method via the REST protocol:
Parameter | Description | Sample value |
---|---|---|
context | Request context, control data, see SOAP/REST Services Request Context. | {"userName": "anonymous", "userFullName": null, "locale": null, "timeZone": null, "maxResults": 1, "currentRole": 'anonymous', "userRoles": null, "sourceOfRequest": null,"maxDepthResult": 1, "decodeResult": "DECODE_DATE_AND_LOB", "ignoreCaseHeaderInResponse": false, "requestProperties": {}} |
someText | Text value that should be returned in the response. | Hello World! |
JSON request example
{
"context": {
"appName": "mercury-ws-app",
"appVersion": "1.0",
"userName": "anonymous",
"comment": null,
"maxResults": 10000,
"queryTimeout": 2147483647,
"locale": "pl_PL",
"timeZone": "Europe/Warsaw",
"userFullName": null,
"eager4omdBuilder": "true",
"trustedData": false,
"ignoredCustomFields": null,
"currentRole": null,
"userRoles": null,
"sourceOfRequest": "USER_DEV.localhost",
"rootVersionContextID": null,
"rootTagName": null,
"directRequest": false,
"formats": {
"date.format.long": "dd-MM-yyyy HH:mm:ss XXX"
},
"ignoreAlternateFields": true,
"decodeResult": "DATE_AND_LOB",
"maxDepthResult": 3,
"decodeRequest": "DATE_AND_LOB",
"ignoreCaseHeaderInResponse": true,
"cacheUsage": "REFRESH",
"httpResponseCacheUsage": "NONE",
"defaultLuceneSortClause": null,
"viewDefinition": null
},
"someText": "Hello World!"
}
Method response​
The table below describes the individual components of the response returned by the echo
method:
Parameter | Description | Example value |
---|---|---|
errorCode | Error code. When the operation is successful, it takes the value null . | null |
errorMessage | The content of the error message. When the operation is successful, it takes the value null . | null |
value | The value of the response. When the operation is successful, it takes the value of the input parameter someText | Hello World! |
Example of the service response in JSON
{
"errorCode": null,
"errorMessage": null,
"value": "Hello World!"
}