Project: Pet Feeder | page_id: 1728
Feeding Record Authentication Interface Documentation
Overview
- Base path: /api
- Documentation scope: feeding record interfaces in the authenticated routes
- Authentication method: request header X-Token
- Content-Type: application/json
Authentication Header
| Field |
Type |
Required |
Description |
| X-Token |
string |
Yes |
The JWT Token obtained after the user logs in |
Unified Response Format
{
"code": 200,
"msg": "Operation successful",
"data": {}
}
Response Field Description
| Field |
Type |
Description |
| code |
integer |
Business status code; 200 means success, other values mean failure |
| msg |
string |
Response message |
| data |
object/array/null |
Business data |
Common Authentication Failure Response
{
"code": 401,
"msg": "Not logged in or login expired",
"data": null
}
{
"code": 401,
"msg": "Login has expired, please log in again",
"data": null
}
Feeding Record Object Field Description
| Field |
Type |
Description |
| deviceId |
string |
Unique device identifier |
| userId |
integer |
Executing user ID |
| userName |
string |
Executing user nickname |
| planId |
integer |
Associated plan ID; usually 0 for manual feeding |
| amount |
integer |
Feeding portion |
| feedTime |
integer |
Feeding timestamp, in seconds |
| createdAt |
string |
Creation time |
1. Get Feeding Records
- Path: /api/feeding/logs
- Method: POST
- Authentication required: Yes
Request Body Parameters
| Field |
Type |
Required |
Description |
| deviceId |
string |
Yes |
Unique device identifier |
| limit |
integer |
No |
Number of records returned. In the current implementation, when it is not passed or is less than or equal to 50, it is treated as 50; when it is greater than 200, 200 records are finally returned |
Request Example
{
"deviceId": "dev_001",
"limit": 100
}
Success Response Example
{
"code": 200,
"msg": "Operation successful",
"data": [
{
"deviceId": "dev_001",
"userId": 1,
"userName": "Xiaoming",
"planId": 12,
"amount": 20,
"feedTime": 1752297600,
"createdAt": "2026-05-09T10:00:00Z"
}
]
}
Response Parameter Description
| Field |
Type |
Description |
| code |
integer |
200 on success |
| msg |
string |
Operation successful on success |
| data |
array |
Feeding record list |
| data[].* |
object |
Feeding record object; see the feeding record object field description above |
Failure Response Example
{
"code": 400,
"msg": "Parameter error",
"data": null
}
{
"code": 500,
"msg": "Failed to get the feeding records",
"data": null
}
Appendix
Description
- Getting feeding records returns an array; when there is no data, an empty array is returned instead of null.
- The final upper limit of limit is controlled by the service to be 200.