PATCH
Use the HTTP PATCH method with the queue resource to modify a queue on a specified queue manager.
Note: This resource URL is available only in version 1 of the REST API. To modify queues using version 2 of the REST API, use the /admin/action/qmgr/{qmgrName}/mqsc resource.This REST API command is similar to the Change, Copy, and Create Queue PCF command, and the ALTER queues MQSC commands.
- Resource URL
- Optional query parameters
- Request headers
- Request body format
- Security requirements
- Response status codes
- Response headers
- Response body format
- Examples
Resource URL
https://host:port/ibmmq/rest/v1/admin/qmgr/{qmgrName}/queue/{queueName}
- qmgrName
- Specifies the name of the queue manager on which the queue to modify exists.
- queueName
- Specifies the name of the queue to modify.
We can use HTTP instead of HTTPS if you enable HTTP connections. For more information about enabling HTTP, see Configure HTTP and HTTPS ports.
Optional query parameters
- commandScope=scope
- This parameter is only available on z/OS .
- force
- Specifies that the command is forced to complete, regardless of whether completing affects an open queue.
Request headers
The following headers must be sent with the request:
- Content-Type
- This header must be sent with a value of application/json optionally followed by ;charset=UTF-8.
- ibm-mq-rest-csrf-token
- This header must be set, but the value can be anything, including being blank.
- Authorization
- This header must be sent if we are using basic authentication. For more information, see Use HTTP basic authentication with the REST API.
The following headers can optionally be sent with the request:
- ibm-mq-rest-gateway-qmgr
- This header specifies the queue manager that is to be used as the gateway queue manager. The gateway queue manager is used to connect to a remote queue manager. For more information, see Remote administration using the REST API.
Request body format
The request body must be in JSON format in UTF-8 encoding. Within the request body attributes are specified, and named JSON objects are created to specify extra attributes to modify. Any attributes that are not specified are not changed.
For example, the following JSON contains the attribute type, and then the named JSON objects, events and storage. The named JSON objects define the additional attributes to modify the queue to disable queue depth high events, and change the maximum queue depth to 2000:{ "type": "local", "events" : { "serviceInterval" : { "highEnabled" : false, "okEnabled" : false }, "storage" : { "maximumDepth" : 2000 } }
For more examples, see examples.
The following attributes can be included in the request body:
- type
- String.
The following objects can be included in the request body to specify extra attributes:
- remote
- Contains attributes that are related to remote queues. The attributes in this object are supported only for remote queues.
- alias
- Contains attributes that are related to alias queues. The attributes in this object are supported only for alias queues.
- model
- Contains attributes that are related to model queues. The attributes in this object are supported only for model queues.
- cluster
- Contains attributes that are related to clusters.
- trigger
- Contains attributes that are related to triggering.
- events
- Contains two objects, one for queue depth and one for queue service interval events. Each object contains attributes that are related to the event type.
- applicationDefaults
- Contains attributes that are related to default behavior such as message persistence, message priority, shared input settings, and read ahead settings.
- queueSharingGroup
- Contains attributes that are related to queue sharing groups on z/OS.
- dataCollection
- Contains attributes that are related to data collection, monitoring, and statistics.
- storage
- Contains attributes that are related to message storage, such as the maximum depth of the queue, and the maximum length of messages that are allowed on the queue.
- general
- Contains attributes that are related to general queue properties, such as whether get or put operations are inhibited, the description of the queue, and transmission queue settings.
- extended
- Contains attributes that are related to extended queue properties, such as backout queue settings, and shared input settings.
For more information, see Request body attributes for queues.
Security requirements
The caller must be authenticated to the mqweb server and must be a member of one or more of the MQWebAdmin, MQWebAdminRO, or MQWebUser roles. For more information about security for the administrative REST API, see IBM MQ Console and REST API security.
If token based security is used, the LTPA token that is used to authenticate the user must be provided with the request as a cookie. For more information about token-based authentication, see Use token-based authentication with the REST API.
The security principal of the caller must be granted the ability to issue the following PCF commands for the specified queue manager:- For the queue that is specified by the {queueName} portion of the resource URL, authority to issue the MQCMD_CHANGE_Q PCF command must be granted.
On UNIX, Linux, and Windows, we can grant authority to security principals to use IBM MQ resources by using the setmqaut command. For more information, see setmqaut (grant or revoke authority).
On z/OS, see Set up security on z/OS.
Response status codes
- 204
- Queue modified successfully.
- 400
- Invalid data provided.
- 401
- Not authenticated.
- 403
- Not authorized.
- 404
- Queue does not exist.
- 500
- Server issue or error code from IBM MQ.
- 503
- Queue manager not running.
Response headers
The following headers are returned with the response:
- ibm-mq-qmgrs
- On z/OS, if the optional query parameter
commandScope=* is used, this header is returned with a comma-separated list of the queue managers
that generated a response. For example, the header might look like the following header:
ibm-mq-qmgrs: MQ21, MQ22
- ibm-mq-rest-gateway-qmgr
- This header is returned if a remote queue manager is specified in the resource URL. The value of this header is the name of the queue manager that is used as the gateway queue manager.
Response body format
The response body is empty if the queue is modified successfully. If an error occurs, the response body contains an error message. For more information, see REST API error handling.
Examples
- The following example modifies an alias queue called aliasQueue. The following
URL is used with the HTTP PATCH method:
https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/queue/aliasQueue
The following JSON payload is sent:{ "type": "alias", "alias": { "targetName": "aDifferentLocalQueue" } }
Parent topic: /admin/qmgr/{qmgrName}/queue