Retrieve the list of products in the current user's shopping cart, supporting pagination, and returning detailed product information and related shopping cart data.
Precautions
- The interface supports logged-in users and non-logged-in users (identified through cart token)
- Supports pagination queries, which can be controlled by the current and pageSize parameters
- The returned product information includes the quantity, price, and other information in the shopping cart
- Total field returns the total quantity of items in the shopping cart
Request address
{域名地址}/api/cart/list
Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/cart/list
Request syntax
GET {域名地址}/api/cart/list?{参数}
Request header
| Field Name |
Type |
Required |
Description |
| cart |
string |
No |
When not logged in, use this token as user identification |
This interface also involves common request headers. For more information, please seeCommon Request Headers (Common Request Headers).
Request Parameters
| Field Name |
Type |
Required |
Description |
| Current |
integer |
No |
Get specified page data, current page number |
| pageSize |
integer |
No |
Number of items to display, number of items per page |
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 |
| data |
object[] |
Result Content |
| total |
integer |
Document count |
data result item parameter
| Field Name |
Type |
Description |
| id |
integer |
Document ID |
| cart_id |
integer |
Shopping Cart ID |
| quantity |
integer |
Quantity |
| amount |
integer |
Amount, unit in cents |
| origin_amount |
integer |
Original amount, unit in cents |
| order_extra |
object |
Order Extended Information |
| is_wholesale |
bool |
Whether it is a wholesale product |
| Title |
string |
Document Title |
| SEO Title |
string |
Document SEO Title |
| url_token |
string |
Document URL Alias |
| Keywords |
string |
Document keywords |
| Description |
string |
Document Summary |
| module_id |
integer |
Document Model ID |
| category_id |
integer |
Document Category ID |
| views |
integer |
Document views |
| comment_count |
integer |
Document comments |
| images |
string array |
Document Group Image |
| Logo |
string |
Document Logo |
| Thumbnail |
string |
Document Thumbnail |
| flag |
string |
Document recommendation attributes, headline [h] recommendation [c] feature [f] special recommendation [a] scroll [s] bold [h] image [p] jump [j] |
| Canonical URL |
string |
Canonical URL |
| fixed_link |
string |
Document Fixed Link |
| created_time |
integer |
Document Publish Timestamp |
| updated_time |
integer |
Document Update Timestamp |
| status |
integer |
Document Display Status |
| user_id |
integer |
User ID |
| Price |
integer |
Price, in cents |
| Stock |
integer |
Stock Quantity |
| user_id |
integer |
User ID |
Example Usage
Request Example
GET /api/cart/list?current=1&pageSize=20 HTTP/1.1
Host: your-domain.com
Content-Type: application/json
Response Example
{
"code": 0,
"data": [
{
"id": 1,
"created_time": 1607308159,
"updated_time": 1662717106,
"title": "关于AnqiCMS",
"seo_title": "",
"url_token": "design",
"keywords": "",
"description": "安企内容管理系统(AnqiCMS),是一款使用 GoLang 开发的企业站内容管理系统,它部署简单,软件安全,界面优雅,小巧,执行速度飞快,使用 AnqiCMS 搭建的网站可以防止众多安全问题发生。",
"module_id": 1,
"category_id": 1,
"views": 1338,
"comment_count": 0,
"images": null,
"template": "",
"status": 1,
"canonical_url": "",
"fixed_link": "",
"flag": "",
"user_id": 0,
"price": 0,
"stock": 9999999,
"has_pseudo": 0,
"keyword_id": 0,
"origin_url": "",
"origin_title": "",
"category": null,
"module_name": "",
"data": null,
"logo": "https://en.anqicms.com/uploads/202012/7/bd36c37ef742c7be.webp",
"thumb": "https://en.anqicms.com/uploads/202012/7/thumb_bd36c37ef742c7be.webp",
"extra": {
"author": {
"name": "作者",
"value": "AnqiCMS",
"default": null
},
"certificate": {
"name": "学历",
"value": null,
"default": null
},
"city": {
"name": "城市",
"value": null,
"default": null
}
},
"link": "https://en.anqicms.com/design"
}
],
"msg": "",
"total": 2
}
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 |