Modifying and deleting existing configurations by using REST

The steps that are involved in modifying or deleting an existing configuration on the IBM® MQ Appliance depend on the level of the change that you want to make.

Modify the property-level configuration

To modify an existing property value, you overwrite the existing value with a payload that contains an updated value. To overwrite the value, first retrieve the current property value, see Retrieve an individual object property.

In this example, you want to change the IP address that is assigned to Ethernet interface 4 on the appliance. First, you retrieve the current value of the IPAddress property of the eth4 object that belongs to the EthernetInterface object class:

GET https://mqhost.com:5554/mgmt/config/default/EthernetInterface/eth4/IPAddress
You receive the following response:
{
        "_links" : {
           "self" : {
               "href" : "/mgmt/config/default/EthernetInterface/Eth4/IPAddress"
           }, 
           "doc" : {
               "href" : "/mgmt/docs/config/EthernetInterface/IPAddress"
           }
         }, 
        "IPAddress" : "198.51.100.1/24"
}
Modify the property payload that is received to remove the _links{} stanza and change the property value to the new required value. Any properties that reference other configuration objects on the appliance must also remove the embedded href link. In the case of the IPAddress property example, the following listing shows the modified payload:
{"IPAddress" : "203.0.113.10/24"}
After the modified payload is composed, you can overwrite the existing property value by sending an HTTP PUT request as shown in the following example. Updating the configuration on the property level allows for updating one property value per request.
PUT https://mqhost.com:5554/mgmt/config/default/EthernetInterface/eth4
After the target property is updated, a confirmation response is received:
{
  "_links": {
    "self": {
      "href": "/mgmt/config/default/EthernetInterface/
               eth4/IPAddress"
    },
    "doc": {
      "href": "/mgmt/docs/config/EthernetInterface"
    }
  },
  "IPAddress": "property has been updated."
}

Modify the object-level configuration

To update multiple property values with a single request, an update on the object level is required.

To modify an existing object configuration, overwrite the existing configuration with an updated payload. To overwrite the configuration, retrieve the current configuration of the object to be modified. In the following example, the configuration for the host alias object that is named Thur_server is retrieved.

GET https://mqhost.com:5554/mgmt/config/default/HostAlias/Thur_server
{
        "_links" : {
           "self" : {
              "href" : "/mgmt/config/default/HostAlias/Thur_server"
           }, 
           "doc" : {
              "href" : "/mgmt/docs/config/HostAlias"
           }
        }, 
        "mAdminState" : "enabled", 
        "UserSummary" : "The thursday server", 
        "IPAddress" : "198.51.100.30"
        }
}
The payload is modified to remove the _links{} stanza and amend property values as required:
{
        "mAdminState" : "enabled", 
        "UserSummary" : "The Thurleigh server", 
        "IPAddress" : "198.51.100.99"
}
You then put the payload that describes the Thur_server object back to the HostAlias configuration:
PUT https://mqhost.com:5554/mgmt/config/default/HostAlias
After the target object is updated, a confirmation response is received:
{
  "_links": {
    "self": {
      "href": "/mgmt/config/default/HostAlias/Thur_server"
    },
    "doc": {
      "href": "/mgmt/docs/config/HostAlias"
    },
    "Thur_server": "Configuration has been updated."
}

Delete the object-level configuration

You can delete configurations at the object level. For example, you can delete a particular host alias from the HostAlias configuration:
DELETE https://mqhost.com:5554/mgmt/config/default/HostAlias/Green_server
You receive confirmation that the deletion has succeeded:
{
  "_links": {
    "self": {
      "href": "/mgmt/config/default/HostAlias/Green_server
    },
    "doc": {
      "href": "/mgmt/docs/config/HostAlias"
    }
  },
  "HostAlias": {
    "value": "Configuration has been deleted."
  }
}