Example of retrieving status by using REST
There are a number of major steps involved in retrieving status from the IBM® MQ Appliance by using the REST management interface.
Identify a required status class
To begin retrieving the required status provider data from the appliance, first identify the
specific status provider class that you need. To identify the required status class name, access the
REST management interface root URI by using a GET request to identify the status root
URI:
GET https://mqhost.com:5554/mgmt/
You receive the following
response:
{
"_links": {
"self": {
"href": "/mgmt/"
},
"config": {
"href": "/mgmt/config/"
},
"domains": {
"href": "/mgmt/domains/config/"
},
"status": {
"href": "/mgmt/status/"
},
"actionqueue": {
"href": "/mgmt/actionqueue/"
},
"filestore": {
"href": "/mgmt/filestore/"
},
"metadata": {
"href": "/mgmt/metadata/"
},
"types": {
"href": "/mgmt/types/"
}
}
}
You can identify the status root URI in the received response as
/mgmt/status/
.
Then, to retrieve a list of all available status provider classes on the appliance, make the
following request:GET https://mqhost.com:5554/mgmt/status/
To identify the exact formatting of the status provider class name, you search the received
response payload. The following listing shows some fragments of the received
response:
{
"_links": {
"self": {
"href": "/mgmt/status/"
},
"ActiveUsers": {
"href": "/mgmt/status/{domain}/ActiveUsers"
},
"Battery": {
"href": "/mgmt/status/{domain}/Battery"
},
"ConnectionsAccepted": {
"href": "/mgmt/status/{domain}/ConnectionsAccepted"
},
...
"LogTargetStatus":{
"href":"/mgmt/status/{domain}/LogTargetStatus"
},
"MQSystemResources":{
"href":"/mgmt/status/{domain}/MQSystemResources"
},
"NDCacheStatus2":{
"href":"/mgmt/status/{domain}/NDCacheStatus2"
},
...
}
}
Retrieve complete status data
After you identify the required status provider class name, you can retrieve the associated status
data. To retrieve the data, you construct a URI of the form
/mgmt/status/domain/class_name
, replacing
domain with the string defaultand class_name with the desired status provider class. The following request shows a URI to retrieve information from the
MQSystemResources
status provider within the default
domain:https://mqhost.com:5554/mgmt/status/default/MQSystemResources
The status provider returns the following
information:
{
"_links" : {
"self" : {
"href" : "/mgmt/status/default/MQSystemResources"
},
"doc" : {
"href" : "/mgmt/docs/status/MQSystemResources"}
},
"MQSystemResources" : {
"TotalStorage" : 15667,
"UsedStorage" : 9216,
"TotalErrorsStorage" : 1024,
"UsedErrorsStorage" : 40,
"TotalTraceStorage" : 2048,
"UsedTraceStorage" : 281,
"HAStatus" : "",
"HAPartner" : ""
}
}
The following request shows a URI to retrieve information from the
DateTimeStatus
status provider within the default
domain:https://mqhost.com:5554/mgmt/status/default/DateTimeStatus
The status
provider returns the following
information:{
"_links" : {
"self" : {
"href" : "/mgmt/status/default/DateTimeStatus"
},
"doc" : {
"href" : "/mgmt/docs/status/DateTimeStatus"}
},
"DateTimeStatus" : {
"time" : "Mon Oct 31 14:29:37 2016",
"timezone" : "GMT",
"tzspec" : "GMT0BST,M3.5.0/1:00,M10.5.0/2:00",
"uptime2" : "3 days 03:19:14",
"bootuptime2" : "3 days 03:21:39"
}
}
Retrieve partial status data
You can also retrieve the value of a specific status provider property, instead of retrieving the
status provider output in its entirety. To retrieve the value, you construct a URI of the form
/mgmt/status/domain/class_name/property_name
.
You replace domain with the string default, class_name with the required status provider class, and property_name with the specific property name as it appears in the complete status provider response. For example, you could enter the following URI to retrieve just the up time from the datetime status provider:
https://mqhost.com:5554/mgmt/status/default/DateTimeStatus/uptime2
The status provider returns the following
information:
{
"_links" : {
"self" : {
"href" : "/mgmt/status/default/DateTimeStatus/uptime2"
},
"doc" : {
"href" : "/mgmt/docs/status/DateTimeStatus/uptime2"}
},
"DateTimeStatus" : {
"uptime2" : "3 days 03:19:14",
}
}