Add the specified product to the user's favorite list, supports specified product SKU, applicable to the favorite operation in e-commerce functions.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- You need to log in to perform the operation
- You must specify the product ID
- Specify the specific product specification by SKU ID
- If the product has been favorited, it will return the corresponding prompt information
Request address
{域名地址}/api/favorite/add
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/favorite/add
Request Syntax
POST {域名地址}/api/favorite/add
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 |
| archive_id | int | Is |
| sku_id | int | No |
Response header
This interface only involves common 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/favorite/add HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"archive_id": 1,
"sku_id": 1
}
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 |