Get document parameter filtering conditions interface

Get document parameter filtering conditions interface

Retrieve the document parameter filtering conditions of a specified model, return the fields and options available for filtering in the model, suitable for building the front-end interface for document filtering functionality.

Points to note

  • The interface requires a model ID to retrieve the filtering conditions of the corresponding model
  • The filtering conditions returned are based on the field types set in the model
  • The filter option includes the total count of statistics, making it easy for users to understand the number of documents under each option

Request address

{域名地址}/api/archive/filters

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

Request Syntax

GET {域名地址}/api/archive/filters?{参数}

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
moduleId int Is Model ID
showCategory bool No Whether to display category filtering
parentId int No The parent category ID in category filtering, default as0
categoryId int No The current category ID
showPrice bool No Whether to display price filter
allText string No Text of all options in price filter, default to全部
showAll bool No The text of all options in the price filter,showAll=falseMeans not to display

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 array[object] result content

Data result parameter

Field name Type Description
name string Filter name
field_name string Filter field call name
items array[object] filter parameter list
filter parameter list item
Field name Type Description
label string parameter options
Total int Quantity

Usage Example

Request example

GET /api/archive/filters?moduleId=1 HTTP/1.1
Host: your-domain.com
Content-Type: application/json

Response Example

{
  "code": 0,
  "data": [
    {
      "name": "城市",
      "field_name": "city",
      "items": [
        {
          "label": "全部",
          "total": 0
        },
        {
          "label": "北京",
          "total": 0
        },
        {
          "label": "上海",
          "total": 0
        },
        {
          "label": "重庆",
          "total": 0
        },
        {
          "label": "广州",
          "total": 0
        },
        {
          "label": "天津",
          "total": 0
        }
      ]
    },
    {
      "name": "学历",
      "field_name": "certificate",
      "items": [
        {
          "label": "全部",
          "total": 0
        },
        {
          "label": "硕士",
          "total": 0
        },
        {
          "label": "本科",
          "total": 0
        },
        {
          "label": "大专",
          "total": 0
        },
        {
          "label": "高中",
          "total": 0
        },
        {
          "label": "初中",
          "total": 0
        }
      ]
    }
  ],
  "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