Get Category List Interface

API Call Address

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

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

Calling method

GET

Request parameters

Field name Type Required Description
moduleId int No Model ID, which can obtain the classification list of a specified 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 category. Must specify model ID moduleId when getting the top-level category.
all bool No Whether to get all categories, all=true to get all categories, if specified at the same timemoduleId,then get all categories under the specified model.
limit int No Display quantity, 'limit' can specify the display quantity, paginated by how many items, for example, 'limit="10"' will only display 10 items. When 'limit' is not used in a pagination list, it supports the 'offset' mode, which is the comma-separated mode. If you want to start from the second item and get 10 items, you can set it to 'limit="2,10"'.

Return parameters

Field name Type Description
code int error code
msg string error reason description
data object[] result content

data result item parameters

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 description
module_id int Model ID
content string Category content details
type int Category Attributes, 1 Category, 3 Single Page
Sort int Category Sorting Value
images string[] Category Banner Image
Logo string Category Thumbnail
Thumb string Category Thumbnail
Created Time int Category Publish Timestamp
updated_time int Category update timestamp
status int Category display status

request data example

Parameter Value
moduleId 1
parentId 0

Return 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 Description
0 OK
-1 Error, the reason is indicated in the msg
1001 Not logged in
1002 Unauthorized
200 API request OK