Add a specified product to the user's wish list, supporting settings such as notes, price, priority, and more.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- Provide product ID, SKU ID can be provided optionally
- The user must be logged in, verified through session or Token
- You can set the wish price, notes, and priority
- If the product is already in the wish list, it may update the existing record
Request address
{域名地址}/api/wishlist/add
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/wishlist/add
Request Syntax
POST {域名地址}/api/wishlist/add
Content-Type: application/json
Request Headers
This interface also involves common request headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Request parameters
| Field name | Type | Required | Description |
|---|---|---|---|
| archive_id | int | Is | Product ID |
| sku_id | int | No | SKU ID, specify specific specifications |
| remark | string | No | User remarks information |
| origin_price | int | No | Price added at the time (unit: cents) |
| status | int | No | Record status, default is enabled |
| target price | int | No | Desired price, the price expected by the user (unit: cents) |
| priority | int | No | Priority, the higher the number, the higher the priority |
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
normal request example
POST /api/wishlist/add HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"archive_id": 123,
"sku_id": 456,
"remark": "生日礼物",
"origin_price": 599900,
"target_price": 550000,
"priority": 1
}
Normal response example
{
"code": 0,
"msg": "保存成功"
}
Error request example - missing required parameters
POST /api/wishlist/add HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"sku_id": 456,
"remark": "生日礼物"
}
Example of error response
{
"code": -1,
"msg": "商品ID不能为空"
}
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 |
| 3001 | Product ID cannot be empty |
| 3002 | This product is already in the wish list |
| 3003 | Product does not exist |