DELETE
Use the HTTP DELETE method with the queue resource to
delete a specified queue on a specified queue manager.
This REST API command is similar to the Delete Queue PCF command, and the DELETE queues MQSC commands.
Resource URL
IBM® MQ 9.0.4 and later:
https://host:port/ibmmq/rest/v1/admin/qmgr/{qmgrName}/queue/{queueName}IBM MQ 9.0.3 and earlier:
https://host:port/ibmmq/rest/v1/qmgr/{qmgrName}/queue/{queueName}- qmgrName
- Specifies the name of the queue manager on which the queue to delete exists.
- queueName
- Specifies the name of the queue to delete.
You can use HTTP instead of HTTPS if you enable HTTP connections. For more information about
enabling HTTP, see Configuring HTTP
and HTTPS ports.
Optional query parameters
- keepAuthorityRecords
![[UNIX, Linux, Windows]](ngulw.gif)
This parameter is only available on the IBM MQ Appliance, UNIX, Linux®, and Windows.- commandScope=scope
This parameter is only available on z/OS®.- purge
- Specifies that all messages are purged from the queue.
- queueSharingGroupDisposition=disposition
This parameter is only available on z/OS.
Request headers
- ibm-mq-rest-csrf-token
- This header must be sent with a value that is the content of the
csrfTokencookie. The content of thecsrfTokencookie is used to confirm that the credentials that are being used to authenticate the request are being used by the owner of the credentials. That is, the token is used to prevent cross-site request forgery attacks. - Authorization
- This header must be sent if you are using basic authentication. For more information, see Using 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
None.
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.
- For the queue that is specified by the {queueName} portion of the resource URL, authority to issue the MQCMD_DELETE_Q PCF command must be granted.
On UNIX, Linux, and Windows, you can
grant authority to security principals to use IBM MQ
resources by using the mqsetaut command. For more information, see mqsetaut.
On z/OS, see Setting up security on z/OS.
Response status codes
- 204
- Queue deleted 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
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 deleted successfully. If an error occurs, the response body contains an error message. For more information, see REST API error handling.
Examples
The following example deletes the queue Q1 from the queue manager
QM1, and purges all messages from the queue when used with the HTTP DELETE method:
IBM MQ 9.0.4 and later: https://localhost:9443/ibmmq/rest/v1/admin/qmgr/QM1/queue/Q1?purgehttps://localhost:9443/ibmmq/rest/v1/qmgr/QM1/queue/Q1?purge
The preceding information applies to releases up to and including