Retrieving view data using the Common REST API
You can use the Common REST API (CRA) to retrieve data using the data endpoint. This endpoint retrieves the data for a specific view and returns the details as 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 data using the data endpoint
The data endpoint uses the GET method to retrieve data for a specific view. Use a URL based on the following structure:
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.
- <viewName> is the name of the view within the product.
Authorization
Name | Located in | Description |
---|---|---|
Authorization | header | Authorization token formatted as 'Bearer [token]' |
Query parameters
This endpoint accepts the following query parameters:
Parameter | Description |
---|---|
context | Context of the server from which you want to retrieve data Default: * |
server | Server from which you want to retrieve data, usually the SSID Default: * |
system | System from which you want to retrieve data, usually the LPAR Default: * |
scope | Scope for which you want to retrieve data Default: * |
period | Timestamp of the data to be retrieved Possible values are:
Default: = |
refresh | Whether to refresh the data for the request Possible values are: Y – Refresh the view data. BMC recommends using this option for the initial request. N – For subsequent requests, to get the same set view data as the previous request. For example, use N to get more rows of data from the same view. Default: Y |
sort | Sorting control string Generates an ORDER statement Example: sort A.D&B.A |
filter | Generates a WHERE clause Example: filter APPLID=CMF&SYSNAME=S* |
startrow | Row from which to start the data retrieval Default: 1 |
rows | Maximum number of rows to return Default: 200 |
session | (optional) Session token for retrieving more data for the same view as a previous data request For more information, see Managing Common REST API session tokens and user tokens. |
close | (optional) Parameter for indicating if a session will stay open or not. For more information, see Managing Common REST API session tokens and user tokens. |
Response body
The returned data is a JSON object containing the following properties:
Property name | Type | Description |
---|---|---|
productName | String | Product name |
viewName | String | View name |
context | String | |
system | String | Only if sent as a header parameter |
server | String | Only if sent as a header parameter |
Time | String | Time of the data |
Startrow | Integer | 1-based index of the first row of data |
Rows | Integer | Total number of rows returned for this request |
Totalrowcount | Integer | Total number of rows available |
rc | Integer | Return code from the API
|
rows | Array of row data | Each object in the rowdata array contains key-value pairs for the data. The key refers to the dataname property of the column in the view definition. There may or may not be data in the rows array. |
messages | Array of string | Messages from the host server There may or may not be data in the messages array. |
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> = MVMVS
- <viewName> = JCPU
Accept: application/json
Authorization: Bearer 08bc7580-2a7c-4e12-890f-c2b80f4891e8
Response
Content-type: application/json
{
"productName": "MVMVS",
"viewName": "ARD",
"context": "SJSC",
"startrow": 120,
"rowcount": 3,
"totalrowcount": 399,
"rc" : 0 ,
"rows": [
{
"ASIXCPR": "1.719668",
"ASGNAME": "DC$CAS",
"JACT$IHR": "20",
"ASLDPNV": "0",
"ASSSWPR": "0",
"ASIFXBAV": "0",
"ASGCNMC": "STCGEN",
"ASGDMNC": "N/A",
"ASSWMART": "196.278366",
"ASGNPG": "40",
"ASIHVPRT": "0",
"ASSHVPRT": "0",
"ASSFXBAV": "0",
"ASIFIXAV": "546.000000",
"ASSCPSC": "406.570068",
"ASSCSART": "0",
"ASSFIXAV": "538.231689",
"ASGLOCC": "I",
"ASGFIX": "546",
"ASREYFLC": "STC",
"ASSXCPR": "0",
"ASGFIXB": "0",
"ASICSART": "0",
"ASGFLXC": "Active",
"ASGASCT": "00000077",
"ASIWMART": "226.755768",
"ASGDMN": "00",
"ASGFL1C": "Active",
"ASITCBSC": "4.360000",
"ASGXMFC": "X",
"ASICPSC": "4.589999",
"ASSTCBSC": "388.159912",
"ASRETOKN": "D7522ECF4403007C",
"ASIDCTTM": "0",
"ASSLPART": "0",
"ASIIPNV": "0",
"ASGJELT": "8282775",
"ASSDCTTM": "0.016128",
"ASGASID": "124",
"ASISWPR": "0",
"ASILPART": "0"
},
{
"ASIXCPR": "0",
"ASGNAME": "ESSXDC",
"JACT$IHR": "20",
"ASLDPNV": "0",
"ASSSWPR": "0",
"ASIFXBAV": "0",
"ASGCNMC": "STCGEN",
"ASGDMNC": "N/A",
"ASSWMART": "1.033173",
"ASGNPG": "40",
"ASIHVPRT": "0",
"ASSHVPRT": "0",
"ASSFXBAV": "0",
"ASIFIXAV": "146.000000",
"ASSCPSC": "2.080000",
"ASSCSART": "0",
"ASSFIXAV": "145.876556",
"ASGLOCC": "I",
"ASGFIX": "146",
"ASREYFLC": "STC",
"ASSXCPR": "0",
"ASGFIXB": "0",
"ASICSART": "0",
"ASGFLXC": "Active",
"ASGASCT": "00000071",
"ASIWMART": "0.545183",
"ASGDMN": "00",
"ASGFL1C": "Active",
"ASITCBSC": "0",
"ASGXMFC": "X",
"ASICPSC": "0",
"ASSTCBSC": "1.750000",
"ASRETOKN": "D7522ED9F2B2007D",
"ASIDCTTM": "0",
"ASSLPART": "0.000024",
"ASIIPNV": "0",
"ASGJELT": "8281655",
"ASSDCTTM": "0.109696",
"ASGASID": "125",
"ASISWPR": "0",
"ASILPART": "0"
},
{
"ASIXCPR": "0",
"ASGNAME": "BP01",
"JACT$IHR": "20",
"ASLDPNV": "0",
"ASSSWPR": "0",
"ASIFXBAV": "0",
"ASGCNMC": "STCGEN",
"ASGDMNC": "N/A",
"ASSWMART": "1.693616",
"ASGNPG": "40",
"ASIHVPRT": "0",
"ASSHVPRT": "0",
"ASSFXBAV": "0",
"ASIFIXAV": "129.000000",
"ASSCPSC": "3.520000",
"ASSCSART": "0",
"ASSFIXAV": "129.000000",
"ASGLOCC": "I",
"ASGFIX": "129",
"ASREYFLC": "STC",
"ASSXCPR": "0",
"ASGFIXB": "0",
"ASICSART": "0",
"ASGFLXC": "Active",
"ASGASCT": "00000072",
"ASIWMART": "1.768367",
"ASGDMN": "00",
"ASGFL1C": "Active",
"ASITCBSC": "0.020000",
"ASGXMFC": "X",
"ASICPSC": "0.040000",
"ASSTCBSC": "1.470000",
"ASRETOKN": "D7522ECF4539007E",
"ASIDCTTM": "0",
"ASSLPART": "0",
"ASIIPNV": "0",
"ASGJELT": "8282774",
"ASSDCTTM": "0",
"ASGASID": "126",
"ASISWPR": "0",
"ASILPART": "0"
}
]
}
Related Topic