POST /messagingrest/v1/queues/{queue-name}/messages

Publish message to a queue.

Request

Path Param: queue-name, java.lang.String
Header Param: Content-Type required, java.lang.String
Header Param: x-qos required, java.lang.Integer - available values : 0, 1
Header Param: x-message-expiration, java.lang.Integer - min: 1, max: 2592000000, default: 2592000000

Content-Type: */* (content type of the message)
Request Body: (byte[])

A test message

Response

204 No Content

Message published successfully.

400 Bad Request

In cases of invalid values for request parameters.

Content-Type: application/json
Response Body:

{
  "message": "x-qos is invalid"
}

404 Not Found

If queue does not exist.

Content-Type: application/json
Response Body:

{
  "message": "Queue does not exist"
}

POST /messagingrest/v1/topics/{topic-name}/messages

Publish message to a topic.

Request

Path Param: topic-name, java.lang.String
Header Param: Content-Type required, java.lang.String
Header Param: x-qos required, java.lang.Integer - available values : 0, 1
Header Param: x-message-expiration, java.lang.Integer - min: 1, max: 2592000000, default: 2592000000

Content-Type: */* (content type of the message)
Request Body: (byte[])

A test message

Response

204 No Content

Message published successfully.

400 Bad Request

In cases of invalid values for request parameters.

Content-Type: application/json
Response Body:

{
  "message": "message is null or empty"
}

POST /messagingrest/v1/queues/{queue-name}/messages/consumption

Consume message from a queue.

Request

Path Param: queue-name, java.lang.String
Header Param: x-qos required, java.lang.Integer - available values : 0, 1

Request Body: No body

Response

200 OK

Header Param: X-Message-Id, java.lang.String - Message id that must be passed in acknowledgement API

Content-Type: */* (content type of the message)
Response Body: (byte[])

A test message

204 No Content

If queue is empty.

404 Not Found

If queue does not exist.

Content-Type: application/json
Response Body:

{
  "message": "Queue does not exist"
}

POST /messagingrest/v1/queues/{queue-name}/messages/{message-id}/acknowledgement

Acknowledge message consumption.

Request

Path Param: queue-name, java.lang.String
Path Param: message-id required, java.lang.String - Message id as received in X-Message-Id header of message consumption API

Request Body: No body

Response

202 Accepted

Request for acknowledging message is accepted.

400 Bad Request

For invalid message id.

Content-Type: application/json
Response Body:

{
  "message": "Invalid message id"
}

POST /messagingrest/v1/subscriptions

Create subscription.

Request

Header Param: Content-Type, java.lang.String

Content-Type: application/json
Request Body: (Subscription)

With no authentication:
{
	"name": "subscription-name",
	"address": "queue:queue-name",
	"qos": 1,
	"pushConfig": {
		"type": "webhook",
		"endpoint": "https://mywebhook.com/messages",
		"exemptHandshake": true
	}
}
With basic authentication:
{
	"name": "subscription-name",
	"address": "queue:queue-name",
	"qos": 1,
	"pushConfig": {
		"type": "webhook",
		"endpoint": "https://mywebhook.com/messages",
		"exemptHandshake": false,
		"securitySchema": {
			"type": "basicAuth",
			"user": "user1",
			"password": "welcome123"
		}
	}
}
With OAuth2 authentication, client credentials grant type:
{
	"name": "subscription-name",
	"address": "queue:queue-name",
	"qos": 1,
	"pushConfig": {
		"type": "webhook",
		"endpoint": "https://mywebhook.com/messages",
		"securitySchema": {
			"type": "oauth2",
			"grantType": "client_credentials",
			"clientId": "my_client_id",
			"clientSecret": "my_client_secret",
			"tokenUrl": "https://myuaa.com/oauth/token"
		}
	}
}

Response

202 Accepted

Subscription created.

Content-Type: application/json
Response Body:

{
  "href": "https://{host}/messagingrest/v1/subscriptions/subscription-name"
}

400 Bad Request

For invalid payload.

Content-Type: application/json
Response Body:

{
  "message": "subscription name is invalid"
}

409 Conflict

For duplicate subscription name.

Content-Type: application/json
Response Body:

{
  "message": "subscription already exists"
}

GET /messagingrest/v1/subscriptions

Get subscriptions.

Request

Query Param: filter, java.lang.String - e.g. filter=queue:queue-name

Request Body: No body

Response

200 OK

Content-Type: application/json
Response Body: (List of all subscriptions, or an empty array if none exists. Credentials are omitted.)

[
  {
    "name": "subscription-name",
    "address": "queue:queue-name",
    "qos": 0,
    "pushConfig": {
      "type": "webhook",
      "endpoint": "https://webhook-endpoint.company.com",
      "exemptHandshake": false
    },
    "createdOn": "2018-09-12T10:39:41.210Z",
    "handshakeStatus": "Completed",
    "subscriptionStatus": "Active",
    "subscriptionStatusReason": "",
    "lastSuccessfulDelivery": "2018-09-12T10:39:41.210Z",
    "lastFailedDelivery": "2018-09-12T10:39:41.210Z",
    "lastFailedDeliveryReason": "503"
  }
]

GET /messagingrest/v1/subscriptions/{subscription-name}

Request

Path Param: subscription-name, java.lang.String

Request Body: No body

Response

200 OK

Content-Type: application/json
Response Body: (Subscription)

{
	"name": "subscription-name",
	"address": "queue:queue-name",
	"qos": 0,
	"pushConfig": {
	  "type": "webhook",
	  "endpoint": "https://webhook-endpoint.company.com",
	  "exemptHandshake": false
	},
	"createdOn": "2018-09-12T10:39:41.210Z",
	"handshakeStatus": "Completed",
	"subscriptionStatus": "Active",
	"subscriptionStatusReason": "",
	"lastSuccessfulDelivery": "2018-09-12T10:39:41.210Z",
	"lastFailedDelivery": "2018-09-12T10:39:41.210Z",
	"lastFailedDeliveryReason": "503"
}

400 Bad Request

If subscription name is invalid.

Content-Type: application/json
Response Body:

{
  "message": "subscription name is invalid"
}

404 Not Found

If subscription does not exist.

Content-Type: application/json
Response Body:

{
  "message": "no subscriptions found"
}

DELETE /messagingrest/v1/subscriptions/{subscription-name}

Delete subscription by name.

Request

No body

Response

204 No Content

Subscription deleted successfully.

400 Bad Request

If subscription name is invalid.

Content-Type: application/json
Response Body:

{
  "message": "subscription name is invalid"
}

404 Not Found

If subscription does not exist.

Content-Type: application/json
Response Body:

{
  "message": "no subscriptions found"
}

POST /messagingrest/v1/subscriptions/{subscription-name}/handshake

Trigger a handshake request to subscription’s webhook endpoint.

Request

No body

Response

204 No Content

Handshake triggered successfully.

400 Bad Request

If subscription name is invalid.

Content-Type: application/json
Response Body:

{
  "message": "subscription name is invalid"
}

404 Not Found

If subscription does not exist.

Content-Type: application/json
Response Body:

{
  "message": "no subscriptions found"
}

PUT /messagingrest/v1/subscriptions/{subscription-name}/state

Update the state of subscription, i.e. pause or resume the subscription.

Request

Header Param: Content-Type, java.lang.String

Content-Type: application/json
Request Body: (Action)

Pause subscription:
{
	"action": "pause"
}
Resume subscription:
{
	"action": "resume"
}

Response

204 No Content

Subscription paused or resumed.

400 Bad Request

For invalid subscription name, or if action property is missing.

Content-Type: application/json
Response Body:

For invalid subscription name.
{
  "message": "subscription name is invalid"
}
If action property is missing
{
  "message": "action is null or empty"
}

404 Not Found

If subscription does not exist.

Content-Type: application/json
Response Body:

{
  "message": "no subscriptions found"
}

409 Conflict

If handshake is not complete and resume subscription is attempted.

Content-Type: application/json
Response Body:

{
  "message": "handshake not successful"
}