Introduction

The search service is a global and shared resource properties repository that is integrated in the IBM Cloud Platform. It's used for storing and searching cloud resource attributes. It categorizes and classifies resources. A resource is controlled and owned by resource providers within the IBM Cloud platform, such as Cloud Foundry, IBM Containers, or Resource Controller. Resources are uniquely identified by a Cloud Resource Naming identifier (CRN). The properties of a resource include tags and system properties. Both properties are defined within an IBM Cloud billing account, and span across many regions.

API endpoint

api.global-search-tagging.cloud.ibm.com

API endpoint

api.global-search-tagging.cloud.ibm.com

API endpoint

api.global-search-tagging.cloud.ibm.com

API endpoint

api.global-search-tagging.cloud.ibm.com

Authentication

REST APIs require the user to specify an OAuth2 security token in the header to be authorized by the IBM Cloud IAM service. You can obtain a bearer token by using the IBM Cloud command line command ibmcloud iam oauth-tokens. Another way to obtain a bearer token is through an API key. For more information, see Getting an IBM Cloud IAM token by using an API key.

Error handling

The resource manager uses standard HTTP response codes to indicate whether a method completed successfully. A 200 type response always indicates success. A 400 type response is a failure, and a 500 type response is an internal system error.

HTTP Error Code Description Recovery
200 Success The request was successful.
400 Bad Request The input parameters in the request body are either incomplete or in the wrong format. Be sure to include all required parameters in your request.
401 Unauthorized You are not authorized to make this request. Log in to IBM Cloud and try again. If this error persists, contact the account owner to check your permissions.
403 Forbidden The supplied authentication is not authorized to access '{namespace}'.
404 Not Found The requested resource could not be found.
409 Conflict The entity is already in the requested state.
410 Gone The resource is valid but has been removed already in a previous call
500 Internal Server Error offering_name is currently unavailable. Your request could not be processed. Wait a few minutes and try again.

Methods

Find instances of resources

Find resources in the internal search platform for a specific account ID. You can optionally apply query strings. To filter results, you can insert a string using the Lucene syntax and the query string is parsed into a series of terms and operators. A term can be a single word or a phrase, in which case the search is performed for all the words, in the same order. To filter for a specific value regardless of the property that contains it, use an asterisk as the key name. Results are filtered by the account ID and IAM subsystem. Only resources that belong to the account ID and that are accessible by the client are returned.

POST /v2/resources/search
Request

Custom Headers

  • An aplhanumeric string that can be used to trace a request across services. If not specified it will be automatically generated with the prefix "gst-"

Query Parameters

  • The account ID to filter resources.

    Constraints: Value must match regular expression ^[a-fA-F0-9-]+$|^[*]{1}$

  • The maximum number of hits to return. Defaults to 10.

    Constraints: 1 ≤ value ≤ 1000

    Default: 10

  • A search timeout, bounding the search request to be executed within the specified time value and bail with the hits accumulated up to that point when expired. Defaults to the system defined timeout.

    Constraints: 0 ≤ value ≤ 600000

    Default: 0

  • The offset is the index of the item you want to start returning data from. Default is 0.

    Default: 0

  • Comma separated properties name used for sorting

  • Search providers. Supported values are ghost and ims. If not specified, the defaults to ghost only. Specify a single provider.

    Constraints: length ≥ 1

It contains the query filters, the list of fields to be returned, and the search token (initally set to null or undefined)

Response

The results of the requested search.

Status Code

  • A result paging with the list of resources matching the provided filters.

  • Bad Request

  • Unauthorized / Wrong auth token type IAM / Auth token not valid

  • Unauthorized operation

  • Internal Server Error / IAM not initialized / Malformed IAM credentials

  • Search IAM error

  • System problem or unexpected error

Example responses

Find instances of resources

'Find cloud foundry resources, resource controlled enabled resources, or storage and network resources running on classic infrastructure in a specific account ID. You can apply query strings if necessary. To filter results, you can insert a string using the Lucene syntax and the query string is parsed into a series of terms and operators. A term can be a single word or a phrase, in which case the search is performed for all the words, in the same order. To filter for a specific value regardless of the property that contains it, use an asterisk as the key name. Only resources that belong to the account ID and that are accessible by the client are returned. You must use this operation when you need to fetch more than 10000 resource items. The /v2/resources/search prohibits paginating through such a big number. On the first call, the operation returns a live cursor on the data that you must use on all the subsequent calls to get the next batch of results until you get the empty result set. By default, the fields returned for every resources are: "crn", "name", "family", "type", "account_id". You can specify the subset of the fields you want in your request.''

POST /v3/resources/search
Request

Custom Headers

  • An aplhanumeric string that can be used to trace a request across services. If not specified it will be automatically generated with the prefix "gst-"

Query Parameters

  • The account ID to filter resources.

    Constraints: Value must match regular expression ^[a-fA-F0-9-]+$|^[*]{1}$

  • The maximum number of hits to return. Defaults to 10.

    Constraints: 1 ≤ value ≤ 1000

    Default: 10

  • A search timeout, bounding the search request to be executed within the specified time value and bail with the hits accumulated up to that point when expired. Defaults to the system defined timeout.

    Constraints: 0 ≤ value ≤ 600000

    Default: 0

  • Comma separated properties names used for sorting

    Constraints: Value must match regular expression ^[+-]?\w+[\w\-\.]*$

It contains the query filters on the first operation call, or the search_cursor on next calls. On subsequent calls, set the search_cursor to the value returned by the previous call. After the first, you must set only the search_cursor. Any other parameter but the search_cursor will be ignored. The search_cursor encodes all the information needed to get the next batch of limit data.

Example:
Response

The search scan response

Status Code

  • A result paging with the list of resources matching the provided filters.

  • Bad Request

  • Unauthorized / Wrong auth token type IAM / Auth token not valid

  • Unauthorized operation

  • Internal Server Error / IAM not initialized / Malformed IAM credentials

  • Search IAM error

  • System problem or unexpected error

Example responses

Get all supported resource types

Retrieves a list of all the resource types supported by GhoST.

GET /v2/resources/supported_types
Request

No Request Parameters

This method does not accept any request parameters.

Response

A list of resource types supported by GhoST.

Status Code

  • List of supported resource types

  • System problem or unexpected error

Example responses