Get Category List Interface

Get the website category list data, support filtering by model ID, parent category and other conditions, and return detailed information of the category.

Points to note

  • This interface is used to get the classification list information of the website
  • Supports filtering the classification of a specific model by model ID
  • Supports obtaining the child classifications of a specified parent classification
  • Supports fetching all categories or displaying by conditions with pagination
  • Ensure that the domain address is correctly configured

Request address

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

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

Request Syntax

GET /api/category/list

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
moduleId int No Model ID, can get the classification list of the specified document model, such as moduleId="1" to get the classification list of the article model.
parentId int No The parent category, can obtain the child categories under the specified parent category, parentId=“0” when obtaining the top-level category. When obtaining the top-level category, the model ID moduleId must be specified
all bool No Whether to get all categories, all=true to get all categories, if specified at the same time,moduleId, then get all categories under the specified model.
limit int No Display the number, 'limit' can specify the number of items to display, pagination by how many items, for example, if 'limit="10

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

data result item parameter

Field name Type Description
id int Category ID
parent_id int Category Parent ID
Title string Category Name
seo title string Category SEO Title
URL Token string Category URL Alias
keywords string Category Keywords
description string Category introduction
module_id int Model ID
content string category content details
type int Category Attribute Value, 1 Category, 3 Single Page
sort int Category Sorting Value
Images string array Category Banner Image
Logo string Category Thumbnail
thumbnail string Category Thumbnail
created_time int Category Publish Timestamp
updated_time int Category Update Timestamp
status int Category Display Status

Usage Example

Request example

GET /api/category/list?moduleId=1&parentId=0 HTTP/1.1
Host: www.anqicms.com

Response Example

{
  "code": 0,
  "data": [
    {
      "id": 1,
      "created_time": 1607308159,
      "updated_time": 1657761249,
      "title": "AnqiCMS使用帮助",
      "seo_title": "",
      "keywords": "",
      "url_token": "help",
      "description": "",
      "content": "<p><br/></p>",
      "module_id": 1,
      "parent_id": 0,
      "type": 1,
      "sort": 1,
      "images": [],
      "logo": "",
      "status": 1,
      "thumb": "https://en.anqicms.com/uploads/202012/7/bd36c37ef742c7be.webp"
    },
    {
      "id": 2,
      "created_time": 1607308159,
      "updated_time": 1657761249,
      "title": "AnqiCMS模板手册",
      "seo_title": "",
      "keywords": "",
      "url_token": "help",
      "description": "",
      "content": "<p><br/></p>",
      "module_id": 1,
      "parent_id": 0,
      "type": 1,
      "sort": 1,
      "images": [],
      "logo": "",
      "status": 1,
      "thumb": "https://en.anqicms.com/uploads/202012/7/bd36c37ef742c7be.webp"
    }
  ],
  "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