Skip to content

RobustMQ Admin Server HTTP API Common Guide

Overview

RobustMQ Admin Server is an HTTP management interface service, providing comprehensive management capabilities for RobustMQ clusters.

  • Base URL: http://localhost:8080
  • Request Method: Mainly uses POST method
  • Data Format: JSON
  • Response Format: JSON

API Documentation Navigation


Common Response Format

Success Response

json
{
  "code": 0,
  "message": "success",
  "data": {...}
}

Error Response

json
{
  "code": 500,
  "message": "error message",
  "data": null
}

Paginated Response Format

json
{
  "code": 0,
  "message": "success",
  "data": {
    "data": [...],
    "total_count": 100
  }
}

Common Request Parameters

Most list query interfaces support the following common parameters:

ParameterTypeRequiredDescription
limitu32NoPage size, default 10000
pageu32NoPage number, starts from 1, default 1
sort_fieldstringNoSort field
sort_bystringNoSort order: asc/desc
filter_fieldstringNoFilter field
filter_valuesarrayNoFilter value list
exact_matchstringNoExact match: true/false

Pagination Parameters Example

json
{
  "limit": 20,
  "page": 1,
  "sort_field": "create_time",
  "sort_by": "desc",
  "filter_field": "status",
  "filter_values": ["active"],
  "exact_match": "false"
}

Basic Interface

Service Status Query

  • Endpoint: GET /
  • Description: Get service version information
  • Request Parameters: None
  • Response Example:
json
"RobustMQ v0.1.31"

Error Code Description

Error CodeDescription
0Request successful
400Request parameter error
401Unauthorized
403Forbidden
404Resource not found
500Internal server error

Usage Examples

Basic Request Example

bash
# Get service version
curl -X GET http://localhost:8080/

# List query with pagination
curl -X POST http://localhost:8080/mqtt/user/list \
  -H "Content-Type: application/json" \
  -d '{
    "limit": 10,
    "page": 1,
    "sort_field": "username",
    "sort_by": "asc"
  }'

Error Handling Example

bash
# When request fails, detailed error information is returned
{
  "code": 400,
  "message": "Invalid parameter: username is required",
  "data": null
}

Notes

  1. Request Method: Except for the root path / which uses GET method, all other interfaces use POST method
  2. Request Body: Even for query operations, a JSON format request body needs to be sent
  3. Time Format:
    • Input time uses Unix timestamp (seconds)
    • Output time uses local time format string "YYYY-MM-DD HH:MM:SS"
  4. Pagination: Page number page starts counting from 1
  5. Configuration Validation: Resource creation validates configuration format correctness
  6. Access Control: It's recommended to add appropriate authentication and authorization mechanisms in production environments
  7. Error Handling: All errors return detailed error information for easy debugging
  8. Content Type: Requests must set the Content-Type: application/json header

Development and Debugging

Start Service

bash
# Start admin-server
cargo run --bin admin-server

# Or use compiled binary
./target/release/admin-server

Test Connection

bash
# Test if service is running normally
curl -X GET http://localhost:8080/

Log Viewing

The service outputs detailed log information during runtime, including:

  • Request paths and parameters
  • Response status and data
  • Error messages and stack traces

Documentation Version: v3.0
Last Updated: 2024-01-01
Based on Code Version: RobustMQ Admin Server v0.1.31