Retrieving configuration information by using REST

There are a number of major steps that are involved in retrieving configuration information from the IBM® MQ Appliance by using the REST management interface.

Identify the object class

To begin retrieving the required configuration information from the appliance, first identify the specific object class that you need. The configuration root URI for as /mgmt/config/. To retrieve a list of all available configuration object classes on the appliance, make a request based on the following example:
GET https://mqhost.com:5554/mgmt/config/
To identify the exact formatting of the object class name, you search the received response payload. The following listing shows some fragments of the received response:
{
  "_links": {
    "self": {
      "href": "/mgmt/config/"
    }
  },
  "AccessControlList": {
    "href": "/mgmt/config/{domain}/AccessControlList"
  },
  "AuditLog": {
    "href": "/mgmt/config/{domain}/AuditLog"
  },
  "CertMonitor": {
    "href": "/mgmt/config/{domain}/CertMonitor"
  },
  "CRLFetch": {
    "href": "/mgmt/config/{domain}/CRLFetch"
  },
  "CryptoCertificate": {
    "href": "/mgmt/config/{domain}/CryptoCertificate"
  },
  ...
  "TimeSettings":{
     "href":"/mgmt/config/{domain}/TimeSettings"
  },
  "TraceTarget":{
     "href":"/mgmt/config/{domain}/TraceTarget"
  },
  "User":{
     "href":"/mgmt/config/{domain}/User"
  },
  "UserGroup":{
     "href":"/mgmt/config/{domain}/UserGroup"
  },
  ...
}

Alternatively, you can examine the URI that is displayed in the web UI browser window when an object or object list is accessed to identify the format of the object class.

Retrieve the object class list

After you identify the required object class name, you can retrieve a list of objects that exist for that class. To retrieve the list, you construct a URI of the form /mgmt/status/domain/class_name, replacing domain with the string default and class_name with the desired object class. The following request shows a URI to retrieve information from the User object class within the default domain:
https://mqhost.com:5554/mgmt/status/default/User
The User object returns the following information:
{
      "_links" : {
        "self" : {
	  "href" : "/mgmt/config/default/User"
	}, 
        "doc" : {
	  "href" : "/mgmt/docs/config/User"
	}
      }, 
      "User" : [{
	"name" : "admin", 
        "_links" : {
         "self" : {
	    "href" : "/mgmt/config/default/User/admin"
	 }, 
         "doc" : {
	    "href" : "/mgmt/docs/config/User"
	 }
	 }, 
        "mAdminState" : "enabled", 
        "UserSummary" : "Administrator", 
        "AccessLevel" : "privileged"
	 },
	{ 
	"name" : "bob", 
        "_links" : {
         "self" : {
	    "href" : "/mgmt/config/default/User/bob"
	  }, 
         "doc" : {
	    "href" : "/mgmt/docs/config/User"
	  }
	 }, 
        "mAdminState" : "enabled", 
        "UserSummary" : "", 
        "AccessLevel" : "group-defined",
        "GroupName" : {
           "value": "Viewer",
               "href" : "/mgmt/config/default/UserGroup/Viewer"
        }
	 }
	]
}

Retrieve an individual object

You can also retrieve the configuration information about a specific object, instead of retrieving the object list output in its entirety. To retrieve information about a specific object, you construct a URI of the form /mgmt/config/domain/class_name/object_name. You replace domain with the string default, class_name with the required object class, and object_name with the name of a particular object that has been configured. For example, you could enter the following URI to retrieve just the details for the user with the ID bob:
https://mqhost.com:5554/mgmt/config/default/User/bob
The object returns the following information:
{
        "_links" : {
            "self" : {
               "href" : "/mgmt/config/default/User/bob"
            }, 
            "doc" : {
                "href" : "/mgmt/docs/config/User"
            }
         }, 
         "User" : {
            "name" : "bob", 
            "mAdminState" : "enabled", 
            "UserSummary" : "", 
            "AccessLevel" : "group-defined", 
            "GroupName" : {
               "value": "Viewer", 
                  "href" : "/mgmt/config/default/UserGroup/Viewer"
               }
         }
}

Retrieve an individual object property

You can also retrieve the value of a particular property from the configuration information of a specific object. To retrieve the value of a property, you construct a URI of the form /mgmt/config/domain/class_name/object_name/property_name. You replace domain with the string default, class_name with the required object class, object_name with the name of a particular object that has been configured, and property_name with the name of the property whose value you want to retrieve. For example, you could enter the following URI to retrieve the value of the AccessLevel property for the user with the ID bob:
https://mqhost.com:5554/mgmt/config/default/User/bob/AccessLevel
The object returns the following information:
{
        "_links" : {
          "self" : {
            "href" : "/mgmt/config/default/User/bob/AccessLevel"
          }, 
          "doc" : {
            "href" : "/mgmt/docs/config/User/AccessLevel"
          }
        }, 
        "AccessLevel" : "group-defined"
}