Get shopping cart list interface

Get the list of products in the current user's shopping cart, support pagination, and return product details and related shopping cart data.

Points to note

  • The interface supports logged-in users and non-logged-in users (identified through cart token)
  • Support pagination, 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 number of items in the shopping cart

Request address

{域名地址}/api/cart/list

Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/cart/list

Request Syntax

GET {域名地址}/api/cart/list?{参数}

Request Headers

Field name Type Required Description
cart string No Use this token as user identification when not logged in

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
current int No Retrieve specified pagination data, current page number
pageSize int No Display quantity, number per page

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
data object[] result content
Total int Document count

data result item parameter

Field name Type Description
id int Document ID
cart_id int Shopping cart ID
quantity int Quantity
amount int Amount, in cents
original amount int Original amount, in cents
order_extra object Order extension information
is_wholesale bool Is it a wholesale product
Title string Document title
seo title string Document SEO Title
URL Token string Document URL Alias
keywords string Document keyword
description string Document Introduction
module_id int Document Model ID
category_id int Document Category ID
Views int Document Views
Comment Count int Document Comment Volume
Images string array document group chart
Logo string document logo
thumbnail string document thumbnail
flag string Document recommendation attribute, headline [h] recommendation [c] slide [f] featured [a] scroll [s] bold [h] image [p] jump [j]
canonical_url string canonical URL
fixed link string document fixed link
created_time int document publish timestamp
updated_time int document update timestamp
status int document display status
user_id int user ID
price int price, in cents
stock int inventory quantity
user_id int user ID

Usage Example

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 Not authorized
200 API request OK