Deleting a queue by using a REST Administration API

System administrators can delete queues by using a REST Administration API.

About this task

You can delete a queue by using a REST Administration API, or by using the IBM® IoT MessageSight Web UI. For more information about using the IBM IoT MessageSight Web UI to delete a queue, see Configuring queues by using the IBM IoT MessageSight Web UI.

Note: You cannot delete a queue unless the queue is empty, or you discard the messages on the queue by specifying DiscardMessages=true.

Procedure

To delete a queue, use the IBM IoT MessageSight REST API DELETE method with the following IBM IoT MessageSight configuration URI:

http://<admin-endpoint-IP:Port>/ima/v1/configuration/Queue/<NameOfQueue>?DiscardMessages=true|false

Where:

NameOfQueue
Specifies the name of the queue you want to delete.
You cannot delete a queue unless the queue is empty, or you discard any messages on the queue by specifying DiscardMessages=true
DiscardMessages=true|false
Optional.
Specifies whether any messages on the queue are discarded.
The default value is false.

Example

The following example demonstrates deleting a queue named testQ by using cURL.

curl -X DELETE
    http://127.0.0.1:9089/ima/v1/configuration/Queue/testQ?DiscardMessages=true

The following example shows an example response to the DELETE method:


{        
  "Version": "v1",
  "Code": "CWLNA6011",
  "Message": "The requested configuration change has completed successfully."
}