Retrieving a view definition using the Common REST API
You can use the Common REST API (CRA) to retrieve a view definition using the definition endpoint. This endpoint retrieves the definition 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 a view definition using the definition endpointe
The definition endpoint uses the GET method to retrieve a view definition. Use a URL based on the following structure:
https://<hostName>:<portNumber>/cra/serviceGateway/services/<serviceName>/products/<productName>/views/<viewName>/definition
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]' |
Header parameters
This endpoint accepts the following header 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 PAS ID Default: * |
system | System from which you want to retrieve data, usually the LPAR Default: * |
scope | Scope for which you want to retrieve data Default: * |
Response body
The returned data is a JSON object containing the view definition with the following properties:
Property name | Type | Description |
---|---|---|
productName | String | Product name |
viewName | String | View name |
ezmenu | Boolean | True or false |
description | String | Description of the view |
disptype | String | Display type |
columns | Array of columns (see below) |
Each element in the columns array contains a JSON object with the following properties
Property name | Type | Description |
---|---|---|
id | String | Mapped to the base.field property |
field | String | Name of the property in the data row object (dataname tag in the MVI reference) |
visible | Boolean | True if the column is displayed, false otherwise |
header | Array of strings | A string for each line of the header |
fieldtype | String | Enumeration of the field types |
disptype | String | Format of the field |
hyperlinks (optional) | Array of string | Array of strings containing the hyperlink |
thresholds (optional) | Array of string | Threshold expressions for column |
attrlike (optional) | String | ID of column to copy the thresholds evaluations from |
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" : "JCPU",
"ezmenu" : "true",
"description" : "Interval job CPU utilization",
"disptype" : "TABLE",
"columns" : [
{
"id" : "A",
"field" : "ASGNAME",
"visible" : "false",
"header" : ["Jobname", "------------"],
"fieldtype" : "KEY",
"disptype" : "C 8 0",
"hyperlinks" : ["A = * FORM EZMJOB;WHERE ASRETOKN = KK"],
"thresholds" : ["A > 2 7"]
},
{
"id" : "B",
"field" : "JACT$INT",
"visible" : "true",
"header" : ["Interval", "Date------"],
"fieldtype" : "NORMAL",
"disptype" : "D 10 0",
"hyperlinks" : ["A = * TIME B C 1I"],
"thresholds" : ["A = * 7"]
},
{
"id" : "C",
"field" : "JACT$INT",
"visible" : "true",
"header" : ["Intvl", "Time------"],
"fieldtype" : "NORMAL",
"disptype" : "T 5 0",
"hyperlinks" : ["A = * TIME B C 1I"],
"attrlike" : ["B"]
}
]
}
Related Topic