Verify the validity of email addresses, supporting different scenarios such as email verification and password reset.
Points to note
- This interface is used to verify the validity of email addresses
- Supports various verification scenarios (email verification, password reset, etc.)
- Ensure the validity of the request source through token and code parameters
- Supports returning data in or html format
- The operation will be executed based on the state parameter after the verification is successful
- Ensure that the domain address is correctly configured
Request address
{域名地址}/api/verify/email
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/verify/email
Request Syntax
GET /api/verify/email
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 |
|---|---|---|---|
| token | string | No | Token value, verify if it is from a valid source |
| code | string | No | Code value, verify if it is from a valid source |
| string | No | Email address | |
| State | string | No | state value, verify = verify email address is valid, reset = reset password, other values are not judged, exist = check if email exists |
| return | string | No | Return data format, or html, default is |
Response header
This interface only involves common response headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Return parameters
Return data in different formats according to the return value of the request parameter:
- When return=, return JSON format data
- When return=html, return HTML format data
JSON format return parameter
| Field name | Type | Description |
|---|---|---|
| code | int | Error code |
| msg | string | Error description |
Usage Example
Request example
GET /api/verify/email?token=abc123&code=xyz789&[email protected]&state=verify&return=json HTTP/1.1
Host: www.anqicms.com
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 | Not authorized |
| 200 | API request OK |