Get the classification list interface

API call address

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

illustrate:{域名地址}You need to replace it with your domain address, such ashttps://en.anqicms.com/api/category/list

Calling methods

GET

Request parameters

Field name type Required illustrate
moduleId int no Model ID, which can be used to obtain the classification list of a specific document model, such as moduleId=“1” to get the classification list of the article model.
parentId int no Parent category, can get the subcategories under the specified parent category, parentId='0' when getting the top-level categories. When getting the top-level categories, the model ID moduleId must be specified.
all bool no Whether to obtain all categories, all=true to obtain all categories, if specified at the same time,moduleId, then get all categories under the specified model.
limit int no Display quantity, 'limit' can specify the display quantity, and it pages by how many quantities, for example, if 'limit' is set to '10', only 10 items will be displayed. When 'limit' is not used in a pagination list, it supports the 'offset' mode, which is also known as comma-separated mode. If you want to start from the second item and retrieve 10 items, it can be set to 'limit'='2,10'.

Return parameters

Field name type illustrate
code int Error code
msg string Error Cause Description
data object[] Results content

data result item parameter

Field name type illustrate
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 Classification keywords
Description string Category Introduction
module_id int Model ID
content string Category content details
type int Classification attribute value, 1 category, 3 single pages
sort int Classification sorting values
images string[] Category Banner Image
logo string Classification thumbnails
thumb string Classification thumbnails
created_time int Classified publishing timestamp
updated_time int Classification update timestamp
status int Classification display status

Request data example

parameter value
moduleId 1
parentId 0

Return to the data 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 illustrate
0 OK
-1 Error, the error reason is indicated in msg
1001 Not logged in
1002 Unauthorized
200 API Request OK