API Reference
The FastBee backend provides RESTful APIs, and all requests must carry a JWT token.
Page Guide
Scope and Boundaries
- The RESTful APIs target management-side integration and custom development, covering management operations on products, devices, thing models, scene linkage, and other resources.
- Device data reporting and command delivery do not go through HTTP APIs; they use the MQTT protocol and are handled by the backend's built-in MQTT Broker.
- The endpoint definitions in the backend source code
fastbee-open-apimodule are authoritative; see Backend Development for the module structure.
Authentication
Get a Captcha
Login requires a graphical captcha by default (controlled by the system parameter sys.account.captchaEnabled, on by default). Call the captcha endpoint first:
GET /captchaImageResponse:
{
"code": 200,
"msg": "操作成功",
"captchaEnabled": true,
"uuid": "c9a1b2c3...",
"img": "/9j/4AAQSkZJRg..."
}imgis the base64-encoded captcha image; the default captcha type is arithmetic, socodeis the result of the expression shown in the imageuuidlinks the captcha to the login attempt and must be passed unchanged in the login request- If
captchaEnabledisfalse(captcha disabled in the system parameters), the login request can omitcodeanduuid
Get a Token
POST /login
Content-Type: application/json
{
"username": "admin",
"password": "admin123",
"code": "8",
"uuid": "the uuid returned by captchaImage above"
}Response:
{
"code": 200,
"msg": "操作成功",
"token": "eyJhbGciOiJIUzI1NiJ9..."
}Request Header
All subsequent requests must carry:
Authorization: Bearer {token}Common Endpoints
Product Management
| Method | Path | Description |
|---|---|---|
| GET | /iot/product/list | Product list |
| POST | /iot/product | Create a product |
| PUT | /iot/product | Edit a product |
| DELETE | /iot/product/ | Delete a product |
Device Management
| Method | Path | Description |
|---|---|---|
| GET | /iot/device/list | Device list |
| POST | /iot/device | Create a device |
| PUT | /iot/device | Edit a device |
| DELETE | /iot/device/ | Delete a device |
| GET | /iot/device/runningStatus?deviceId= | Device running status |
Thing Model
| Method | Path | Description |
|---|---|---|
| GET | /iot/thingsModel/list | Thing model list |
| POST | /iot/thingsModel | Create a thing model |
Scene Linkage
| Method | Path | Description |
|---|---|---|
| GET | /iot/scene/list | Scene list |
| POST | /iot/scene | Create a scene |
| PUT | /iot/scene | Edit a scene |
| DELETE | /iot/scene/ | Delete scenes |
| PUT | /iot/scene/updateStatus | Enable/disable a scene |
Online Documentation and Call Verification
The full API documentation is available via Swagger: after starting the backend, visit http://localhost:8080/swagger-ui.html.
Call verification example:
# 1. Get a captcha, note the returned uuid, and solve the arithmetic expression in the image
curl http://localhost:8080/captchaImage
# 2. Log in to get a token (code is the captcha result, uuid comes from the previous step)
curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123","code":"8","uuid":"uuid from the previous step"}'
# 3. Call a business endpoint with the token
curl http://localhost:8080/iot/product/list \
-H "Authorization: Bearer {token}"If step 3 returns the product list data, authentication and endpoint calls are working.
FAQ
The endpoint returns 401?
The token is missing or expired, or it is not placed in the Authorization header in the Bearer {token} format; call /login again to get a new token and retry.
Login returns a captcha error?
Login requires a captcha by default: call /captchaImage first to get the uuid and captcha image, fill code with the result of the arithmetic expression in the image (the default type), and pass the uuid unchanged in the login request. Make sure code and uuid come from the same captcha request and have not expired.
How do I see the complete endpoint list?
Visit the Swagger documentation at http://localhost:8080/swagger-ui.html after starting the backend; the corresponding controller list is also in the "API Controller Layer" section of Backend Development.
Which endpoint returns device real-time data?
Use GET /iot/device/runningStatus?deviceId={deviceId}; the device must be connected to the platform and have reported data, otherwise the result is empty.


