Software AG Products 10.5 | Using API Gateway | REST APIs in API Gateway | API Gateway Search
 
API Gateway Search
The API Gateway search API allows you to execute a search query in API Gateway and retrieve search results that match the search query.
Remember:
When your search involves a large number of records, the process consumes a considerable memory space from the server, which in turn affects other business transactions. Hence, Software AG recommends that you perform large search operations when you expect lesser business transactions so that the regular business is not affected.
API Gateway provides the following REST API resources:
*POST/rest/apigateway/search: Executes a search query in API Gateway and returns the results that match your query. You can perform search across the different objects such as APIs, Applications, Aliases, Assertions, Policies, Administration Settings, Policy properties, Packages, Plans, Subscriptions, Users, User groups, Transactional events, Lifecycle events, Policy violation events, Monitor events, Error events, Threat protection events, and Performance metrics.
To perform a search operation, specify the following in your REST request:
REST Request Section
Description
Types
Objects for which you want to perform the search operation. You can specify one or more of the listed objects.
Note:
When you specify Users and User Groups in the Types section to return the list of users and user groups from Integration Server respectively, you need not specify any search criteria.
Scope
Search Criteria. You must specify your search attribute and a keyword (value of the attribute) or one of the following as your search criteria:
*Time range - to retrieve results for a date range (from and to values), from a specified date to current date, till a specified date, or since the given amount of time (seconds, minutes, hours, days, weeks, months, quarters, or years).
*Value range - to retrieve results for a integer value range (from and to values), from a given value to the maximum value, and from 0 to the given value.
You can specify multiple attributes in this section.
Note:
The search operation is performed based on the search criteria specified in this section for all objects specified in the Types section.
Condition
One of the following:
*and - to return results that match all search criteria.
*or - to return results that match any of the given criteria.
Fields
Fields to be returned in the response. You can specify only the required fields, instead of viewing all fields in your response. That is, if you want to view only the API Names and Versions that match your search criteria, you can specify apiName and apiVersion in this section of your REST request.
*POST/rest/apigateway/search/_count: Retrieves the total number of records for the specified scope and types.
To retrieve the count of records, you can specify the required types and scope similar to the /search query. If you do not specify any search criteria in the Scope section, then the query returns total number of assets for the objects specified in the Types section.
*POST/rest/apigateway/search/_aggregations: Executes a search query and groups the results for the specified scope and types.
To perform an aggregations search, specify the following in your REST request:
REST Request Section
Description
Types
Objects for which you want to perform the search operation. You can specify one or more of the listed objects.
Scope
Search Criteria. You must specify your search attribute and a keyword (value of the attribute) or one of the following as your search criteria:
*Time range - to retrieve results for a date range (from and to values), from a specified date to current date, till a specified date, or since the given amount of time (seconds, minutes, hours, days, weeks, months, quarters, or years).
*Value range - to retrieve results for a integer value range (from and to values), from a given value to the maximum value, and from 0 to the given value.
Condition
One of the following:
*and - to return results that match all search criteria.
*or - to return results that match any of the given criteria.
Aggregations
Values for the following:
*Name - Specify a name used to group the required results. For example, you can specify Info by API, if you are grouping the results by APIs.
*Type - One of the following:
*group - to group the results based on the given fields.
*timeseries - to group results based on a given interval value. The interval can be seconds, minutes, hours, days, weeks, months, quarters, or years.
*metrics - to find the average, minimum, maximum and sum of given fields.
*Fields - Fields to be considered for the aggregation. If the type is group and there are multiple fields, separate the field names with commas.
For details about the REST API, see the APIGatewaySearch.json at Install directory/IntegrationServer/instances/default/packages/WmAPIGateway/resources/apigatewayservices.
For sample payloads, see https://github.com/SoftwareAG/webmethods-api-gateway/blob/master/apigatewayservices/postmancollections/apis/search-service/SearchService.json.
Note:
The number of transactions returned for a search is based on the value specified in the defaultSearchSize extended setting. If your search result exceeds the value of this setting, then you can navigate through your search results by specifying the range of records that you want to view. For example, the value specified in the defaultSearchSize setting is 1000 and the count of your search result is 5000, then only the first 1000 records are displayed. To view the consequent records, you can specify the number of the record from which you want to view, and the number of records that must be displayed. That is, to view the records from 1001 to 2000, you can specify the range as follows:
POST http://localhost:5555/rest/apigateway/search
{
"types": [
"TRANSACTION_EVENTS" ],
"scope": [
{ "attributeName": "responseCode",
"keyword": "304"
},
],
"from": "1001"
“size”: “1000”
}