Add the specified product to the user's wish list, supporting the setting of notes, price, priority, and other information.
Precautions
- This interface uses the POST method and requires data to be submitted in application/ format
- Product ID is required, and 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 item is already in the wish list, the existing record may be updated.
Request address
{域名地址}/api/wishlist/add
Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/wishlist/add
Request syntax
POST {域名地址}/api/wishlist/add
Content-Type: application/json
Request header
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 | Product ID |
| sku_id | integer | No | SKU ID, specifying specific specifications |
| remark | string | No | User remark information |
| Original Price | integer | No | Price at the time of addition (unit: cents) |
| status | integer | No | Record status, default is enabled |
| target_price | integer | No | Desired price, the price the user expects (unit: cents) |
| priority | integer | No | Priority, the higher the value, the higher the priority |
Response Headers
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 | integer | Error code |
| message | string | Error Description |
Example Usage
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": "生日礼物"
}
Error response example
{
"code": -1,
"msg": "商品ID不能为空"
}
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 |
| 3001 | Product ID cannot be empty |
| 3002 | This product is already in the wish list |
| 3003 | Product does not exist |