Add user message information, supporting username, message content, contact information, and basic information, as well as the submission of custom form fields.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- The username field is required.
- Support custom message form fields
- Message content and contact information are optional
- The system will return the operation result information after submission
- Can be used for website message board or feedback form functionality
Request address
{域名地址}/api/guestbook.html
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/guestbook.html
Request Syntax
POST {域名地址}/api/guestbook.html
Content-Type: application/json
Request Headers
This interface involves only public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Request parameters
| Field name | Type | Required | Description |
|---|---|---|---|
| user_name | string | Is | Username |
| content | string | No | Message content |
| contact | string | No | Contact Information |
| Custom field | string | No | Custom field in the message form |
Response header
This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Return parameters
| Field name | Type | Description |
|---|---|---|
| code | int | Error code |
| msg | string | Error description |
Usage Example
Request example
POST /api/guestbook.html HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"user_name": "anqicms",
"content": "欢迎使用AnqiCMS",
"contact": "13888888888"
}
Request example with custom field
POST /api/guestbook.html HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"user_name": "anqicms",
"content": "欢迎使用AnqiCMS",
"contact": "13888888888",
"email": "[email protected]",
"subject": "产品咨询"
}
Successful response example
{
"code": 0,
"msg": "感谢您的留言!"
}
Failed response example
{
"code": -1,
"msg": "用户名不能为空"
}
error code
| Error code | Description |
|---|---|
| 0 | OK |
| -1 | Error, the reason is indicated in msg |
| 1001 | Not logged in |
| 1002 | Not authorized |
| 200 | API request OK |