MongooseIM's REST API for frontend or client
In addition to the regular XMPP connection methods such as TCP (with TLS/STARTTLS), WebSockets and BOSH, MongooseIM provides parts of its functionality over a REST API.
Assumptions
- Every request has to be authenticated. Please see the Authentication section for more details.
- We strongly advise that this API is served over HTTPS.
- User registration has to be done via other methods (f.e. using the REST API for backend services).
- The relevant endpoint has to be configured on the server side. See the configuration section.
- A list of provided actions is documented with Swagger. See the specification.
Authentication
MongooseIM uses Basic Authentication as an authentication method for the REST API.
Basic authentication is a simple authentication scheme built into the HTTP protocol.
Each HTTP request to the client REST API has to contain the Authorization header
with the word Basic
followed by a space and a base64-encoded string
username@host:password
, where:
username@host
is the user's bare JID,password
is the password used to register the user's account.
For example, to authorize as alice@localhost
with the password secret
, the
client would send a header:
1 |
|
Configuration
Handlers have to be configured as shown in the REST API configuration example to enable REST API.
In order to get the client REST API up and running simply copy the provided example. For more details about possible configuration parameters please see the relevant documentation of the listeners, in particular the client REST API handlers section.
Smack library support
REST API can fetch messages for Smack Stanza Properties.
For example if we have properties in the stanza like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
OpenAPI specifications
See the Swagger documentation for more information.