Get Document Category Interface

Retrieve all document category information in the system, supporting filtering by module type (article or product), used for content import or classification management functionality.

Precautions

  • This interface uses the GET method
  • Need to provide a valid backend import interface Token for authentication
  • Must specify the module ID to get the corresponding category type
  • Supports obtaining article category and product category types
  • The category information returned includes hierarchy (distinguished by parent_id)

Request address

{域名地址}/api/import/categories?token={token}

Description:{域名地址}It needs to be replaced with your domain address.{token}The Token needs to be replaced with the one in the background content import interface function:https://en.anqicms.com/api/import/categories?token=xxx

Request syntax

GET {域名地址}/api/import/categories?token={token}&module_id={module_id}

Request Parameters

Field Name Type Required Description
token string Yes Token in the background content import interface function
module_id integer Yes Enter the category type to get, fill in the number, supported values: 1 Article, 2 Product

Return parameters

Field Name Type Description
code integer Error code
message string Error Description
data array Category list

data Parameter

Field Name Type Description
id integer Category ID
parent_id integer Parent Category ID
Title string Category Title

Example Usage

Request Example

GET /api/import/categories?token=4712a54b4c456bb29b7816d241db69a7&module_id=1 HTTP/1.1
Host: www.anqicms.com

Response Example

{
  "code": 200,
  "data": [
    {
      "id": 1,
      "parent_id": 0,
      "title": "golang实战教程"
    },
    {
      "id": 10,
      "parent_id": 0,
      "title": "安企CMS使用帮助"
    },
    {
      "id": 11,
      "parent_id": 10,
      "title": "安企CMS基础"
    },
    {
      "id": 13,
      "parent_id": 10,
      "title": "安企CMS模板制作"
    },
    {
      "id": 12,
      "parent_id": 10,
      "title": "安企CMS后台操作教程"
    }
  ],
  "msg": "获取成功"
}

Error response example

{
  "code": -1,
  "msg": "Token无效"
}

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