Skip to main content
Version: 0.0.1

YedMQ Management REST API

To support development on various types of platforms, YedMQ offers an API that adheres to RESTful design standards,namely the REST API.

Base Path

YedMQ distinguishes API versions on the REST API, and all current APIs start with /api/v1.

HTTP Headers

Most APIs require the Accept header to be set to application/json, and the response content will be in JSON format.

HTTP Response Status Code

CodesDescription
200Request successfully.
401Unauthorized.
404Not Found. You can refer to the message field in the body to check the reason.

Authentication

Currently, YedMQ primarily uses Http Basic Authentication.

Using Http Basic Authentication

In this method, you authenticate API requests using the username and password configured in the YedMQ configuration file.

Adding Username and Password

You can add credentials in the configuration file, for example:

[listener.api.auth]
users = [
{ username = "admin", password = "password" } # Must be on a single line
]

You can add multiple user credentials:

  • username: The username
  • password: The password

Note: Due to the limitations of the TOML format, each user configuration must be on a single line.

✅ Correct configuration:

[listener.api.auth]
users = [
{ username = "admin", password = "password" }
]

❌ Incorrect configuration:

[listener.api.auth]
users = [
{
username = "admin", password = "password"
}
]

Every time YedMQ starts, it reads the credentials from the configuration file and checks them during API requests.

Example request:

curl -X GET http://localhost:3456/api/v1/plugins \
-u admin:password \
-H "Content-Type: application/json"

Pagination

For some APIs with large amounts of data, pagination functionality is provided.

offset & limit

In most APIs that support pagination, you can control the pagination by using the offset and limit parameters.If not provided the params, the default offset is 0 and the default limit is 10.

Example:

GET /api/v1/plugins?offset=0&limit=10

In the response result ,the meta field will contain pagination information.

Example:

{
"meta": {
"offset": 0,
"limit": 10,
"total": 1
},
"data": [
{
"name": "YedMQ_Acl_File_Plugin",
"version": "0.0.1",
"description": "This plugin provides file-based ACL (Access Control List) management.",
"entry": "./libyedmq_plugins_acl_file.so",
"priority": 1000,
"author": "yedmq"
}
]
}

Error Codes

when an error happens, the error code is returned in JSON format by the Body:

{
"code": 3,
"message": "Tenant a not existed"
}
Error CodesDescription
3Tenant not existed
101Internal server error