The HTTP interface implements an HTTP API to publish and retrieve messages.
For shiftr.io Cloud instances the interface is only available over the secure HTTP port
443 (HTTPS) to ensure all data is transmitted using an encrypted channel.
With shiftr.io Desktop the interface is only available over the insecure HTTP port
1884 due to the lack of a certificate. Another port is selected if the port is already in use by another application.
In the following examples you need to replace
ENDPOINT with the URI that points to your shiftr.io Cloud instance or shiftr.io Desktop app.
For shiftr.io Cloud instances the endpoint URI is constructed as follows:
httpsis used as the scheme.
INSTANCE_NAMEis the name of your instance.
TOKEN_SECRETis the tokens secret as configured in the settings panel.
INSTANCE_DOMAINis the full domain to your instance.
With shiftr.io Desktop the endpoint URI is constructed as follows:
httpis used as the scheme.
IP_OR_DOMAINis the IP address or domain of the machine running shiftr.io Desktop.
GET method is used to retrieve the latest published message:
Wildcards can also be used to retrieve messages:
retained query parameter may be set to get the latest retained message published matching the topic filter:
POST method is used to publish a message:
curl -X POST 'ENDPOINT/broker/foo/bar' -d 'Hello World!'
retained query parameter may be set to publish a retained message:
curl -X POST 'ENDPOINT/broker/foo/bar?retained=true' -d 'Hello World!'
qos query parameter may be used to set a specific quality of service level:
curl -X POST 'ENDPOINT/broker/foo/bar?qos=2' -d 'Hello World!'
- The basic authentication fields
passwordare used to transmit the instance name and token secret.
- As most browsers and HTTP tools interpret the wildcard
#as fragments, the
@can be used instead.
- The wildcard
*is automatically replaced with
- The topic length is limited to 128 characters.
- The payload size of a POST request is limited to 64 KB.
Messages published by an 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.
Any available HTTP library can be used with the HTTP interface.