The REST API provides the following methods to perform message searches:
Running Message Searches
Searches are started by posting a request to the appropriate resource for the desired type of search. Each search takes a JSON parameter providing the search parameters, and returns a 201 Created
response if the search was successfully started. Search results are subsequently retrieved using the provided result set URL.
A specific access right is required for performing any full text searches using any of the searching API methods, which is in addition to any other access right required by the specific REST API method. If a full text parameter is provided but the caller does not have this access right then the search request fails with a 403 Forbidden
error. This requirement is in place because the full text searches are by far the most resource intensive searches, and a poorly constructed full text search can take a significant amount of time to run.
Starting Archive Searches
POST /api/search/errorqueue
URI |
|
---|---|
Description |
Starts a search over the Error Queue. Search parameters include limiting results by time range and component. The search is limited to lockers for which the user has the search permissions for the Error and Hold Queues. |
Request Header |
|
Accept: application/ Content-Type: application/vnd.orchestral.rhapsody.6_0+json CSRF Protection Enabled |
|
Request Body |
The search parameter data object structure as follows:
|
Response Status |
{ "data":{ "state":"COMPLETED", "limitedByDataValidation":false, "results":[ { "timestamp":"20121005T120107\u002E415\u002B1300", "messageIdentifier":"1\u002E621952\u002E9318", "rootMessageIdentifier":"1\u002E621952\u002E9312" }, { "timestamp":"20121005T120105\u002E440\u002B1300", "messageIdentifier":"1\u002E622208\u002E9335", "rootMessageIdentifier":"1\u002E622208\u002E9313" }, { "timestamp":"20121005T120103\u002E401\u002B1300", "messageIdentifier":"1\u002E611712\u002E9210", "rootMessageIdentifier":"1\u002E611712\u002E9205" }, ], "searchTime":"PT0\u002E006S", "completionTime":"20121017T111121\u002E371\u002B1300", "moreResults":false, "previousUri":"https://localhost:8444/api/search/resultset/2/previous" }, "error":null } |
Response Body | Empty. |
Access Rights |
'Search Error Queue REST API'. |
POST /api/search/holdqueue
URI |
|
---|---|
Description |
Starts a search over the Hold Queue. Search parameters include limiting results by time range and component. The search is limited to lockers for which the user has the search permissions for the Error and Hold Queues. |
Request Header |
|
Accept: application/json Content-Type: application/vnd.orchestral.rhapsody.6_0+json CSRF Protection Enabled |
|
Request Body |
The search parameter data object structure is the same as POST /api/search/errorqueue. |
Response Status |
{ "data":{ "state":"COMPLETED", "limitedByDataValidation":false, "results":[ { "timestamp":"20121005T120026\u002E638\u002B1300", "messageIdentifier":"1\u002E410240\u002E7051", "rootMessageIdentifier":"1\u002E410240\u002E7046" }, { "timestamp":"20121005T120024\u002E934\u002B1300", "messageIdentifier":"1\u002E396672\u002E6815", "rootMessageIdentifier":"1\u002E396672\u002E6809" }, { "timestamp":"20121005T115939\u002E436\u002B1300", "messageIdentifier":"1\u002E31488\u002E365", "rootMessageIdentifier":"1\u002E31488\u002E358" } ], "searchTime":"PT0\u002E013S", "completionTime":"20121017T112044\u002E447\u002B1300", "moreResults":false, "previousUri":"https://localhost:8444/api/search/resultset/3/previous" }, "error":null } |
Response Body | Empty. |
Access Rights |
'Search Hold Queue REST API'. |
Retrieving and Continuing Search Results
If a search is successful, for example POST /api/search/errorqueue
, a 201 Created
response is returned with a URL to the result set with an associated identifier. You can then retrieve the search results in the result set using its identifier and you can continue your search to retrieve a group of results that come before or after the result set.
Except as provided for in the Search Management API methods, a user can only access their own search results; a 403 Forbidden
received if an attempt is made to retrieve a result set for another user. Result sets are held on a per user basis rather than just a specific session, and therefore can be retrieved from a different HTTP session to that which started them.
GET /api/search/resultset/<id>
URI |
|
---|---|
Description |
Retrieves the search results contained in this result set or status information if it is still running. The result set URL is returned to the caller in the Location HTTP header of the request that started the search. The optional parameters allow the caller to determine which fields are returned for each message found in the response (if not provided then some defaults based on the type of the search are selected). |
Request Header |
|
Accept: application/vnd.orchestral.rhapsody.6_0+json |
|
Accept: application/vnd.orchestral.rhapsody.6_3+json |
|
Request Body |
Provided as query parameters (all optional):
|
Response Status |
|
Response Body |
A successful search is returned with the following data object structure:
|
Access Rights |
Same access rights as the original search request. |
POST /api/search/resultset/<id>/next
URI |
|
---|---|
Description |
Continues the search by finding the next group of results, continuing on from where this result set completed. This is effectively starting a new search, and so returns a new result set with the next set of results. The continue search operation does not start if this result set is the last one (that is, if it is already known that there are no further results). |
Request Header |
|
Request Body |
Empty - uses the parameters supplied in the original search request. |
Response Status | 201 Created - redirect with the location header set to the new result set URL. |
Response Body |
Empty. |
Access Rights |
Same access rights as the original search request (Rhapsody checks permissions again). |
POST /api/search/resultset/<id>/previous
URI |
|
---|---|
Description |
Continues the search by finding the previous group of results, by effectively running a search in the reverse direction, starting from where these results began. This is effectively starting a new search, so returns a new result set with the previous set of results. |
Request Header |
|
Request Body |
Empty - uses the parameters supplied in the original search request. |
Response Status | 201 Created - redirect with the location header set to the new result set URL. |
Response Body |
Empty. |
Access Rights |
Same access rights as the original search request (Rhapsody checks permissions again). |
Search Management
Search Management REST API methods indicate which searches are currently running, which result sets are still being tracked, and provide a way for them to be purged. Unlike the other searching and message view API methods, these methods can be accessed by the root administrator user by default (they do not provide a way to start a search, view results, or view a message).
Limits on result sets are enforced as a limit on the number of searches running at any time, and a limit on the total number of result sets held (which includes both running and completed searches). There are separate limits enforced both per user, and globally across the Rhapsody engine. These limits are configurable via the rhapsody.properties
file and their default values can be changed via the following properties:
Search Limitation |
Property (Per User) and Default Value |
Property (Global) and Default Value |
---|---|---|
Maximum Running Searches |
|
RestAPImaximumRunningSearchesForEngine=10 |
Maximum Result Sets |
RestAPImaximumResultSetsPerUser=10 |
RestAPImaximumResultSetsForEngine=50 |
If a user attempts to start a new search and too many are already running (either for the user or across the engine), then the new search request fails with a 429
error. Completed, canceled or failed searches are automatically discarded if not referenced for more than 10 minutes, but can be kept alive by performing any (non-DELETE) operation on them. If a user attempts to start a new search and they personally already have too many result sets, then the oldest non-running result set is automatically discarded and the search starts successfully (subject to the too many running searches check).
GET /api/search/resultset
URI |
|
---|---|
Description |
Retrieves a list of all result sets for the current user that have been started from the REST API (including those started from other HTTP sessions). Does not retrieve searches started through the Management Console. |
Request Header |
|
Accept: application/vnd.orchestral.rhapsody.6_0+json |
|
Request Body |
Empty. |
Response Status | 200 OK - operation successful. |
Response Body |
Returns an array of result sets each with the following data object structure:
The URI returned for each result set is of the form / |
Access Rights |
None (if you do not have permissions to start a search, you cannot see any results). |
DELETE /api/search/resultset/<id>
URI |
|
---|---|
Description |
Informs the server that the specified result set is no longer required and can be discarded. The server automatically discards result sets to save on memory and disk usage after a period of inactivity, or if the maximum number of result sets per user or globally are reached. Deleting a result set representing a search that is still running cancels that running search. |
Request Header |
|
Request Body |
Empty. |
Response Status |
|
Response Body | Empty. |
Access Rights |
None (this API method only allows you to delete your own result sets, not someone else's). |
DELETE /api/search/resultset
URI |
|
---|---|
Description |
Removes all result sets for the calling user. This is the same as performing an explicit delete on each individual result set. Deleting a result set representing a search that is still running cancels that running search. |
Request Header |
|
Request Body |
Empty. |
Response Status |
|
Response Body | Empty. |
Access Rights |
None (this API method only allows you to delete your own result sets, not someone else's). |
GET /api/search/admin/resultset
URI |
|
---|---|
Description |
Retrieves a list of all result sets started via the REST API for all users. It does not retrieve searches started via the Management Console. |
Request Header |
|
Accept: application/vnd.orchestral.rhapsody.6_0+json |
|
Request Body |
Empty. |
Response Status | 200 OK - operation successful. |
Response Body |
An array of result sets each with the following data object structure:
The resultset objects are identical to those returned from |
Access Rights |
'List all searches for all users REST API'. |
DELETE /api/search/admin/resultset/<id>
URI |
|
---|---|
Description |
Cancels and discards the specified search no matter which user started it from the REST API. |
Request Header |
|
Request Body |
Empty. |
Response Status |
|
Response Body | Empty. |
Access Rights |
'Discard all searches for all users REST API'. |
DELETE /api/search/admin/resultset
URI |
|
---|---|
Description |
Cancels and discards all searches for all users that were started via the REST API. |
Request Header |
|
Request Body |
Empty. |
Response Status |
|
Response Body | Empty. |
Access Rights |
'Discard all searches for all users REST API'. |