Retrieve model details interface

Get detailed information about the specified content model, including basic information, custom field configurations, etc., used for dynamic form building and content management.

Points to note

  • This interface uses the GET method
  • Get model information by model ID or model URL alias
  • Supports getting detailed information of built-in system models and custom models
  • Return the custom field list of the model, used to build a dynamic form
  • Model information includes field types, required configuration information, etc.

Request address

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

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

Request Syntax

GET {域名地址}/api/module/detail

Request parameters

Field name Type Required Description
id int Is Model ID, if filename is provided, ID is not required
filename string No Model URL alias, choose model ID or filename

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 Model ID
Title string Model name
Table Name string Additional Table Name
URL Token string Model URL Alias
is_system int Is the system built-in model
Title Name string Title Name
Fields object[] Model Custom Field List
created_time int Model Publish Timestamp
updated_time int Model Update Timestamp
status int Model Display Status

fields parameter (model custom fields)

Field name Type Description
name string Field Chinese Name
field_name string field name
type string Field type
required boolean Mandatory?
is_system boolean Whether the field is built-in in the system
is_filter boolean Whether the filtering parameter
follow_level boolean Whether to follow the document reading level
content string Default value

Usage Example

Example request to get model details by ID

GET /api/module/detail?id=1 HTTP/1.1
Host: www.anqicms.com

Example request to get model details by URL alias

GET /api/module/detail?filename=product HTTP/1.1
Host: www.anqicms.com

Response Example

{
  "code": 0,
  "data": {
    "id": 2,
    "created_time": 1689603570,
    "updated_time": 1702908648,
    "table_name": "product",
    "url_token": "product",
    "title": "产品中心",
    "fields": [
      {
        "name": "产品参数",
        "field_name": "canshu",
        "type": "text",
        "required": false,
        "is_system": false,
        "is_filter": false,
        "follow_level": false,
        "content": ""
      },
      {
        "name": "批号",
        "field_name": "pihao",
        "type": "text",
        "required": false,
        "is_system": false,
        "is_filter": false,
        "follow_level": false,
        "content": ""
      },
      {
        "name": "产品图片",
        "field_name": "product_images",
        "type": "images",
        "required": false,
        "is_system": false,
        "is_filter": false,
        "follow_level": false,
        "content": ""
      },
      {
        "name": "产品描述",
        "field_name": "description",
        "type": "textarea",
        "required": true,
        "is_system": false,
        "is_filter": false,
        "follow_level": true,
        "content": ""
      }
    ],
    "is_system": 1,
    "title_name": "产品名称",
    "status": 1,
    "link": ""
  },
  "msg": ""
}

Example of error response

{
  "code": -1,
  "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