Document Classification Interface
Retrieve information about all document categories in the system, supporting filtering by module type (article or product), used for content import or categorization management function.
Points to note
- This interface uses the GET method
- An effective background import interface Token is required for authentication
- You must specify the module ID to get the corresponding category type
- Supports obtaining both article categories and product categories
- The category information returned includes hierarchical relationships (distinguished by parent_id)
Request address
{域名地址}/api/import/categories?token={token}
Description:{域名地址}Replace with your domain address,{token}Replace with the Token in the background content import interface function, such ashttps://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 |
Is |
Token in the background content import interface function |
| module_id |
int |
Is |
Enter the category type to retrieve, fill in numbers, supported values: 1 Article, 2 Product |
Return parameters
| Field name |
Type |
Description |
| code |
int |
Error code |
| msg |
string |
Error description |
| data |
array |
Category List |
data parameter
| Field name |
Type |
Description |
| id |
int |
Category ID |
| parent_id |
int |
Parent Category ID |
| Title |
string |
category title |
Usage Example
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": "获取成功"
}
Example of error response
{
"code": -1,
"msg": "Token无效"
}
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 |