Getting details of a saved search with a REST API

Use this endpoint to get details of an existing saved search.

Notes

  • Before running this endpoint, you need to generate an authorization token by running the login endpoint. This token is used to authenticate a user into the product. You need to pass this token in the header each time you want to run the endpoint.
  • If the check.csrf.header.XRequestedWith header property in the olaengineConfig.properties file is set to TRUE, then you need a new header 
    X-Requested-With=XMLHttpRequest to be added to the API calls. For accessing the application in secure mode (from CSRF), the addition of this header is mandatory in every request.

  • To log out from a given session, you need to run the logout endpoint.

For more information, see Developing.

This topic contains the following information:

Endpoint overview

Use the GET method to get details of existing saved searches or all the saved searches existing in the system.

To get details of a particular saved search, you need to specify the saved search name. You can also specify a portion of the saved search name to get details of all the saved searches matching that portion fully and partially. For example, if you provide "SS1" as the name, details for the saved searches "SS1", "SS12", and "ss13" are returned.

If you do not specify any name, details of the all the saved searches are returned.

This endpoint returns the following saved search details:

ItemDescription
Saved search nameName of the saved search.
Saved search ID

Unique number by which you can identify the saved search.

The saved search ID can be used to perform a search while running the following APIs:

Using the search ID while performing a search (rather than a saved search name) might be more useful in scenarios when duplicate saved search names occur. Duplicate saved searches can occur in a scenario where one user creates a saved search with a particular name, while another user creates a saved search with the same name and also marks it as public. In this scenario, the first user can see two saved searches with the same name. Similarly, a duplicate saved search can occur when you import a content pack containing saved search with a duplicate name.

SourceSource of the saved search, whether the source is a content pack, shared by another user, or created by the user.
Source nameName of the source – content pack name or user name (based on the source details).

Request URL

GET <protocol>://<host>:<port>/olaengine/itdaws/searchservices/savedsearch?savedSearchName=<Name>&version=<apiVersion>

Parameter definitions

The following parameters can be used in the request URL.

Parameter nameDescription

<protocol>

Required

Protocol that you want to use for communication with the Console Server.

Can be one of the following:

  • http
  • https

<host>

Required

Host name of the Console Server.

<port>

Required

Port number of the Console Server.

The default port is 9797.

savedSearchName

Optional 

Name of an existing saved search for which you want to get details.
version

Optional

Version of the API.

You can specify the version as 2.5.

Tip: Generally the API version is the same as the product version on which the API can be run.

Examples

The following examples illustrate the inputs for getting details of saved searches by using the GET method:

Example 1: Get details of all the saved searches

The following example illustrates the input and response for getting details of all the saved searches existing in the system.

Request URL

GET http://localhost:9797/olaengine/itdaws/searchservices/savedsearch

Response
{
    "savedSearchInfoList": [{
        "name": "API_Class",
        "id": "102be3d4-8729-44e8-b962-927bfdc30bbc",
        "source": "User",
        "sourceName": "admin"
    }, {
        "name": "CLM:CLMContentPack:Deprovisioning rate in last 7 days",
        "id": "bcb55c2a-8c30-4565-849f-0885f98db382",
        "source": "ContentPack",
        "sourceName": "CLMContentPack"
    }, {
        "name": "CLM:CLMContentPack:Failed Trasactions over last 7 days",
        "id": "ed2cabd7-4169-4199-8903-be689c30f7b8",
        "source": "ContentPack",
        "sourceName": "CLMContentPack"
    }, {
        "name": "warning_message",
        "id": "bc9cdd85-7da8-4fc0-b022-6fd52dff2939",
        "source": "User",
        "sourceName": "admin"
    }]
}

Example 2:  Get details of all the saved searches containing the specified name

The following example illustrates the input and response for getting details of all the saved searches containing "clm" in their names.

Request URL

GET http://localhost:9797/olaengine/itdaws/searchservices/savedsearch?savedSearchName=clm

Response
{
    "savedSearchInfoList": [{
        "name": "CLM:CLMContentPack:Deprovisioning rate in last 7 days",
        "id": "bcb55c2a-8c30-4565-849f-0885f98db382",
        "source": "ContentPack",
        "sourceName": "CLMContentPack"
    }, {
        "name": "CLM:CLMContentPack:Failed Trasactions over last 7 days",
        "id": "ed2cabd7-4169-4199-8903-be689c30f7b8",
        "source": "ContentPack",
        "sourceName": "CLMContentPack"
    }]
}

Response elements

The following sections help you understand the response elements:

Element definitions

Response elementDescription

savedSearchInfoList

Array

Can be one of the following:

  • Successful response: Details of the saved search – name, ID, source and source name.
    For more information, see API overview.
  • Unsuccessful response: Blank value indicating that no matching saved searches were found.

Successful response sample

Response
{
    "savedSearchInfoList": [
        {
            "name": "ITDA data collected over time",
            "id": "itda_ss_1",
            "source": "User",
            "sourceName": "admin"
        }
    ]
}

Unsuccessful response sample

Note: The following response is displayed when no matching saved searches were found. You need to ensure that the saved search name is correct. Alternatively, you can run the API to list details of all the saved searches. For more information, see the examples.

{
    "savedSearchInfoList": []
}

HTTP status codes

The following table describes the status codes that are likely to appear while working with this endpoint.

Status codeDescription
200

Request completed successfully.

Also displayed if no matching saved searches were found.

401Authorization error (invalid authorization token or authorization token not present).
500

Error occurred while processing the request. Occurrence of this error is rare.

For more information, see the error message. Alternatively, see the itda.log located at %BMC_ITDA_HOME%\logs.


Was this page helpful? Yes No Submitting... Thank you

Comments