HiveMQ REST API

The HiveMQ REST API provides an interface for applications to interact programmatically with the HiveMQ Enterprise MQTT broker. Our REST API gives applications a way to send and receive data as JSON (JavaScript Object Notation) objects over standard HTTP.

HiveMQ uses the versatile and widely supported OpenAPI Specification to create standard, machine-readable, programming-language agnostic interface descriptions for REST APIs.

Concepts

An Application Programming Interface (API) is a set of rules that specify how programs talk to each other, exchange data, and interact across the Internet in a consistent format.

Representational State Transfer (REST) is an architectural style that determines the look and feel of the API. The style of the HiveMQ REST API focuses on providing scalability and extensibility.

Rest APIs are stateless and cacheable. In an API that adheres to REST principles, the client does not need to know anything about the structure of the API. The server provides all information that the client needs to interact with the service.

In the REST pattern, you access a specific piece of data (called a resource) when you link to a specific URL. The URL includes a method that defines how you want to interact with the resource.

Each of these URLs is called a request and the data that is sent back to you is called a response.

Enable or Disable the HiveMQ REST API

The HiveMQ REST API can be enabled or disabled. To disable the REST API so that no user or extension developer can use it, set the <enabled> option to false. To enable the REST API, set the <enabled> option to true.

Default Configuration

The HiveMQ REST API uses sensible default settings. Unless otherwise configured, the REST API bind address is at localhost on port 8888. If desired, you can configure multiple listeners at the same time with different ports and bind addresses.

Default Configuration of HiveMQ REST API
<?xml version="1.0"?>
<hivemq>
 ...
 <rest-api>
     <enabled>false</enabled>
     <listeners>
         <http>
             <port>8888</port>
             <bind-address>localhost</bind-address>
         </http>
     </listeners>
 </rest-api>
 ...
</hivemq>

HiveMQ logs the configuration at startup.

Table 1. REST API Configuration Options
Configuration Default Value Description

enabled

false

Enables or disables the use of the HiveMQ REST API. When this option is set to False, no users or extension developers can use the API.

port

8888

The port on the local machine that listens for HiveMQ REST API requests. The port address can be changed.

bind-address

localhost

The address on the local machine that accepts HiveMQ REST API requests. The bind address can be changed.

Multiple listeners can be configured at the same time with different ports and bind addresses.