Retrieving server details using the Common REST API
You can use the Common REST API (CRA) to retrieve server details for a specific product using the servers endpoint. This endpoint retrieves the server details and returns a JSON.
Before you begin
- You must have the CRA installed and running. For more information, see Setting-up-the-Common-REST-API.
- Log in to the service and acquire a token. For more information, see Logging-in-to-a-service-using-the-Common-REST-API.
Retrieving the list of systems using the systems endpoint
The servers endpoint uses the GET method to retrieve server details for a product. Use a URL based on the following structure:
https://<hostName>:<portNumber>/cra/ServiceGateway/Services/<serviceName>/products/<productName>/servers
The variables represent the following values:
- <hostName> is the name of the mainframe host where the CRA server is running.
- <portNumber> is the port number of the CRA server.
- <serviceName> is the name of the service as it appears on the list. For more information, see To retrieve a list of services.
- <productName> is the name of the product as it appears on the list. For more information, see Retrieving-a-list-of-installed-products-using-the-Common-REST-API.
Authorization
Name | Located in | Description |
---|---|---|
Authorization | header | Authorization token formatted as 'Bearer [token]' |
Header parameters
This endpoint accepts the following query parameters:
Parameter | Description |
---|---|
serviceName | (mandatory) Requested service |
productName | (mandatory) Requested product |
context | Context for the view Default: * |
server | Usually is the PAS ID Default: * |
sort | Sorting control string Generates an ORDER statement. You can sort up to 4 parameters Example: sort A.D&B.A A and B represent the IDs from a get view definition request. |
filter | Generates a QWHERE clause Example: filter APPLID=CMF&SYSNAME=S* |
Authorization | User token |
Response body
On successful completion, the response body contains a JSON object containing the server data:
Property | Type | Description |
---|---|---|
productName | string | Product name |
viewName | string | View name |
context | string | Context of the server |
system | string | Only if sent as a path parameter |
server | string | Only if sent as a path parameter |
history | boolean | Indicates whether the returned data is historical |
startrow | integer | 1-based index of the first row of data |
rowcount | integer | Total number of rows returned for this request |
totalrowcount | integer | Total number of rows available |
rc | integer | Return code:
|
servers | list of servers | Each list item is a server |
HTTP status and reason codes
The following HTTP status codes are returned for the indicated errors, and the response body is a standard error response body providing the reason code indicated and associated error message.
Error Code | Explanation |
---|---|
200 | Successful completion |
403 | Unauthorized. The authorization token is missing, invalid or expired |
404 | The path is not valid. Most likely because the service in the URL does not exist. |
Example
Request
The request example uses the following values:
- <hostName> = myCRAhost
- <portNumber> = 443
- <serviceName> = Mva
- <productName> = PLEXMGR
Authorization: Bearer {authToken}
Content-Type: application/x-www-form-urlencoded
Response
Content-type: application/json
{
"productName": "PLEXMGR",
"viewName": "plex",
"context": "*",
"startRow": "1",
"rowCount": 28,
"totalrowcount": 28,
"rc": 0,
"history": false,
"servers": [
"PLEXMGR",
"X32D",
"MVE07171",
"XTS32PAS",
"X32F",
"M32F",
"M32D",
"TSHD"
]
}
Related Topic