Allow users to evaluate purchased products or orders, supporting text evaluation, scoring, and image upload.
Precautions
- This interface uses the POST method and requires data to be submitted in application/ format
- The document ID and review content need to be provided
- Supports both logged-in users and non-logged-in users (non-logged-in users need to provide a username)
- Reviews can be associated with specific orders via order ID
- Supports a 1-5 point rating system
- Supports uploading multiple evaluation images
- Evaluations need to be reviewed before they can be displayed
Request address
{域名地址}/api/review/publish
Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/review/publish
Request syntax
POST {域名地址}/api/review/publish
Content-Type: application/json
Request header
| Field Name | Type | Required | Description |
|---|---|---|---|
| token | string | No | User login token, not required for non-logged-in users |
This interface also involves common request headers. For more information, please seeCommon Request Headers (Common Request Headers).
Request Parameters
| Field Name | Type | Required | Description |
|---|---|---|---|
| archive_id | integer | Yes | Document ID of the evaluation |
| content | string | Yes | Review content |
| score | integer | Yes | Rating, 1-5 points |
| user_name | string | No | Username (required for non-logged-in users) |
| string | No | Email address (optional for non-logged-in users) | |
| order_id | string | No | Order ID, associated with a specific order |
| images | string array | No | Evaluate image array, need to upload through the upload interface first, put the image address here |
Response Headers
This interface only involves public response headers. More information, please refer toCommon Request Headers (Common Request Headers).
Return parameters
| Field Name | Type | Description |
|---|---|---|
| code | integer | Error code |
| message | string | Error Description |
Example Usage
Request Example
POST /api/review/publish HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"archive_id": 140,
"content": "这个产品非常棒,质量很好,发货也很快!",
"score": 5,
"order_id": "202211232209080046",
"images": [
"https://en.anqicms.com/uploads/review/image1.jpg",
"https://en.anqicms.com/uploads/review/image2.jpg"
]
}
Response Example
{
"code": 0,
"msg": "发布成功"
}
Error Code
| Error code | Description |
|---|---|
| 0 | OK |
| -1 | Error, the reason is indicated in msg |
| 1001 | Not logged in |
| 1002 | Unauthorized |
| 200 | API request OK |
| 4001 | Review content cannot be empty |
| 4002 | Rating must be between 1 and 5 |
| 4003 | Invalid document ID |
| 4004 | Not purchased the product, unable to review |
| 4005 | Already reviewed the product |