Get Category Detail Interface

Retrieve detailed information of a specified category, supporting retrieval of category details through category ID or URL alias, returning basic information and content of the category.

Points to note

  • The interface supports retrieval of category details through category ID or URL alias (filename/catname) in two ways
  • The category type includes general categories (type=1) and single-page (type=3)
  • The returned category information includes SEO-related fields for SEO optimization
  • If the category does not exist, the interface will return an error code

Request address

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

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

Request Syntax

GET {域名地址}/api/category/detail?{参数}

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
id int Is Category ID, if filename is passed, ID does not need to be passed
filename string No Category URL alias, either category ID or filename
catname string No Category URL alias, same as filename

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 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 category details by ID:

GET /api/category/detail?id=1 HTTP/1.1
Host: your-domain.com
Content-Type: application/json

Get category details by URL alias:

GET /api/category/detail?filename=help HTTP/1.1
Host: your-domain.com
Content-Type: application/json

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"
  },
  "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