HTTP Interface

HTTP API based client interface.

Implementation

This interface implements a simple HTTP API to publish and retrieve messages.

Ports

The following ports are available on the broker.shiftr.io host:

HTTP HTTPS
80 443

API Description

Retrieve Message

The GET method is used to retrieve the latest published message:

1
curl 'http://try:try@broker.shiftr.io/foo/bar'

Wildcards can also be used to retrieve messages:

1
curl 'http://try:try@broker.shiftr.io/foo/+'

The retained query parameter may be set to get the latest retained message published matching the topic filter:

1
curl 'http://try:try@broker.shiftr.io/foo/+?retained=true'

Publish Message

The POST method is used to publish a message:

1
curl -X POST 'http://try:try@broker.shiftr.io/foo/bar' -d 'Hello World!'

The retained query parameter may be set to publish a retained message:

1
curl -X POST 'http://try:try@broker.shiftr.io/foo/bar?retained=true' -d 'Hello World!'

The qos query parameter may be used to set a specific quality of service level:

1
curl -X POST 'http://try:try@broker.shiftr.io/foo/bar?qos=2' -d 'Hello World!'

Protocol Notes

  • The basic auth username and password fields are used to transmit the tokens key and secret.
  • As most browsers and http tools interpret the wildcard # as fragments, the @ can be used instead.
  • The wildcard * is automatically replaced with +.

Limits

  • The topic (path) length is limited to 128 characters.
  • The payload size of a POST request is limited to 64KB.

Message Ordering

Messages published by a HTTP client are guaranteed to be delivered in the order as they are published if the client waits for the OK response before publishing another message.

Client Libraries

Any available HTTP library can be used with that interface.