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

POST /api/search/errorqueue

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/json
Content-Type: application/json
CSRF Protection Enabled

Accept:   application/json  
Content-Type:   application/vnd.orchestral.rhapsody.6_0+json
CSRF Protection Enabled

Request Body

The search parameter data object structure as follows:

  • sortOrder - [enumerated string] ASCENDING or DESCENDING for the order in which the search is run, the default being DESCENDING.
  • maxResults - [int] the maximum number of search results to return - no more than the default of 1000.
  • receivedTimeRange - [object] defaults to no time restrictions - either a start/end time or a duration can be provided but not both.
  • receivedBy - [array] of numbers representing communication point identifiers of the communication points that the messages must have been received by (defaults to all communication points).
  • messageTableArrivalTimeRange - [object] defaults to no time restrictions - either a start/end time or a duration can be provided but not both.
  • sentFrom - [array] of numbers representing communication point identifiers of the communication points that sent the messages to the error queue - defaults to all communication points.
  • routes - [array] of numbers representing route identifiers of the routes that sent the messages to the error queue (defaults to all routes).
  • fullText - [object] defaults to no full text search.
    • mode - [enumerated string] CASE_SENSITIVE, CASE_INSENSITIVE, or REGULAR_EXPRESSION.
    • value - [str] value to search for.
  • properties - [array] of message properties to search on.
    • name - [str] name of the property to search on.
    • value - [str] property value to search for.

      In each field in the data model, all search parameters are optional and provide for defaults (or are not used in some cases). Consequently, an empty JSON object ({}) is a set of valid search parameters.

      If message properties are used as search parameters then these must be indexed against the output message in order to match (the indexes are written as the message arrives on the error or hold queue).

Response Status

201 Created - redirect with the location header set to the result set URL:

{
  "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'.
'View message bodies REST API' (for fullText search).
'View message metadata REST API' (if searching by message property).
'Search Error and Hold Queues' (on lockers to include in the search).

POST /api/search/holdqueue

URI

POST /api/search/holdqueue

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/json
CSRF Protection Enabled

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

201 Created - redirect with the location header set to the result set URL:

{
  "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'.
'View message bodies REST API' (for fullText search).
'View message metadata REST API' (if searching by message property).
'Search Error and Hold Queues' (on lockers to include in the search).

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

GET /api/search/resultset/<id>

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/json

Accept: application/vnd.orchestral.rhapsody.6_0+json
Accept: application/vnd.orchestral.rhapsody.6_3+json

Request Body

Provided as query parameters (all optional):

  • waitSeconds - [int] the maximum number of seconds to wait for if the search is still running when the request is made (default of zero means do not wait, maximum of 30 seconds).
  • field - repeatable parameter containing enumerated strings of the optional fields to include in the response. Valid values are: COMPONENT, SOURCE, NEXT_DESTINATION, TRACKING_STATE, TOTAL_SEND_COUNT, RECEIVED_TIME, ERROR_DETAILS. The root message identifier, message identifier, and timestamp are always included in the results. An error is thrown if an invalid field type is provided, or if the field type is not applicable to the type of search.
  • property - repeatable parameter containing names of indexed message properties that should be included for each result. An error is returned if a null/empty property name is provided, or if the indexed property does not exist at all. Note that even if the indexed property exists, it may not be available for all messages (that is not an error though).
Response Status

200 OK - operation successful.
202 Accepted - search still running with the same data object structure as for a 200 OK response, but all results may not be available.

Response Body

A successful search is returned with the following data object structure:

  • state - [enumerated string] state of the search ([enum] RUNNING, COMPLETED, CANCELLED).
  • moreResults - [bool] false if and only if we know that there are no additional results to be found as of the time that the search was run; true if we know that there are more results or are not sure. This is not defined if the search is either still running or was canceled.
  • limitedByDataValidation - [bool] true if the results have been limited due to ongoing message store data validation.
  • completionTime - [str] date-time in ISO8601 format representing the date/time that the search completed.
  • searchTime - [str] duration in ISO8601 format representing the time the search took to run).
  • nextUri - [str] URL to use to start the next search - /api/search/resultset/<id>/next. Not included if we know that there are no more results.
  • previousUri - [str] URL to use to start the next search - /api/search/resultset/<id>/previous.
  • results - [array] of search results.
    • messageIdentifier - [str] message identifier.
    • rootMessageIdentifier - [str] root message identifier.
    • timestamp - [str] date-time in ISO8601 format representing the timestamp for the message: input time for input searches; output time for output searches; route received time for intermediate messages; arrival time on the message table for errored and held messages).
    • receivedTimestamp - [str] date-time in ISO8601 format representing the time that the message was originally received by Rhapsody. Not provided for messages migrated from Rhapsody 3.3 or earlier.
    • component - [object] information about the component associated with the message: the input communication point for input messages; the output communication point for output messages; the route for intermediate messages; the previous component to process the message for errored and held messages.
      • id - [int] component identifier.
      • name - [str] component name.
      • folderPath - [str] the folder path, and also the route name if this is a filter.
    • source - [object] information about the communication point that original received the message.
      • id - [int] communication point identifier.
      • name - [str] containing the communication point name.
      • folderPath - [str] the folder path.
    • nextDestination- [object] information about the component that is intended to process the message next: for intermediate messages this is the next filter to process the message; for errored and held messages this is the component that sent them to the error/hold queue; this is not provided for input or output searches.
      • id - [int] component identifier.
      • name - [str] component name.
      • folderPath - [str] component folder path including route name if this component is a filter.
    • errorDetails - [str] the Error Details for an errored message in the Error Queue as displayed in the Management Console.
    • properties - [array] values of indexed properties explicitly asked for in the request where a value exists for this message.
      • name - [str] property name.
      • value - property value.
Example
{
    data: {
        state: " COMPLETED",
        moreResults: false,
        limitedByDataValidation: false,
        completionTime: "20171204T100225.945+1300",
        searchTime: "PT0.003S",
        previousUri: "https://localhost:8444/api/search/resultset/1",
        results: [ 
          {
            messageIdentifier: "1.8576.23",
            rootMessageIdentifier: "1.8576.21",
            timestamp: "20171204T094400.099+1300",
            errorDetails: "Sent from error filter"
          },
          {
            messageIdentifier: "1.8192.20",
            rootMessageIdentifier: "1.8192.18",
            timestamp: "20171204T094355.075+1300",
            errorDetails: "Sent from error filter"
          },
          {
            messageIdentifier: "1.7808.17",
            rootMessageIdentifier: "1.7808.15",
            timestamp: "20171204T094350.088+1300",
            errorDetails: "Sent from error filter"
          }
       ]
    },
    error : null
}

Access Rights

Same access rights as the original search request.
'View message meta data REST API' (only if trying to view message properties in the results).

POST /api/search/resultset/<id>/next

URI

POST /api/search/resultset/<id>/next

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

Accept: application/json
CSRF Protection Enabled

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

POST /api/search/resultset/<id>/previous

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

Accept: application/json
CSRF Protection Enabled

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

RestAPImaximumRunningSearchesPerUser=2

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

GET /api/search/resultset

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/json

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:

  • uri - [str] URI pointing to the result set.
  • state - [enumerated string] RUNNING, COMPLETED, CANCELLED, or FAILED.
  • searchTime - [str] duration in ISO8601 format indicating how long the search took to run or how long it has been running.
  • type - [enumerated string] ERROR_QUEUE, or HOLD_QUEUE.
  • completionTime - [str] date-time in ISO8601 format indicating when the search was completed, canceled or failed (not provided if the search is still running).
  • resultCount - [int] number of results found so far for this search.

The URI returned for each result set is of the form /api/search/resultset/<id> so can be used by the caller to either retrieve the results or purge it. The returned URI cannot be used by any other user as each user effectively has their own URI space for result sets.

Example

Access Rights

None (if you do not have permissions to start a search, you cannot see any results).

DELETE /api/search/resultset/<id>

URI

DELETE /api/search/resultset/<id>

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

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 No Content - operation successful.

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

DELETE /api/search/resultset

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

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 No Content - operation successful.

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

GET /api/search/admin/resultset

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/json

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:

  • user - [str] username.
  • resultSets - [array] of result sets.

The resultset objects are identical to those returned from /api/search/resultset for a specific user, except that the URIs for each result set are different (they are in the form /api/search/admin/resultset/<id>), allowing them to be subsequently used in admin operations (in other words, cancel and discard the search). Note that there is no way for a caller of this API method to use the returned result set URIs to use those URIs to retrieve the search results, unless they were started by that user (in other words, even though an admin can cancel searches for another user they cannot view search results for another user).

Example

Access Rights

'List all searches for all users REST API'.

DELETE /api/search/admin/resultset/<id>

URI

DELETE /api/search/admin/resultset/<id>

Description

Cancels and discards the specified search no matter which user started it from the REST API.

Request Header

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 No Content - operation successful.

Response Body Empty.

Access Rights

'Discard all searches for all users REST API'.

DELETE /api/search/admin/resultset

URI

DELETE /api/search/admin/resultset

Description

Cancels and discards all searches for all users that were started via the REST API.

Request Header

CSRF Protection Enabled

Request Body

Empty.

Response Status

204 No Content - operation successful.

Response Body Empty.

Access Rights

'Discard all searches for all users REST API'.