Retrieve custom parameter information for the specified document, supporting return in two formats: sorted array or unordered map object, used to obtain additional field information set in the document model.
Points to note
- The interface supports obtaining specific document parameters through the document ID
- Control the return format through the sorted parameter: array format or object format
- When the parameter value is separated by newline characters, it indicates that the field is of multi-select type
Request address
{域名地址}/api/archive/params
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/archive/params
Request Syntax
GET {域名地址}/api/archive/params?{参数}
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 | The parameter is obtained by document id to get the specified document parameters |
| sorted | int | No | The supported values are: false|true, when sorted=false, it retrieves an unordered map object, which needs to be accessed using the dot notation.When sorted=true, the array object returned is fixed sorted.The default is true, a fixed sorted array object, so we need to use a for loop to get and output it. |
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 | an object array or an object | result content |
item information of data result when sorted=true
| Field name | Type | Description |
|---|---|---|
| name | string | field name |
| value | string | written value |
| default | string | Default value |
Information of data when sorted is false
Field structure is key => item: key is the name of the form field, each item contains the following information:
| Field name | Type | Description |
|---|---|---|
| name | string | field name |
| value | string | written value |
| default | string | Default value |
Usage Example
Request example
GET /api/archive/params?id=1&sorted=true HTTP/1.1
Host: your-domain.com
Content-Type: application/json
Response Example
When sorted is true, the value is returned
{
"code": 0,
"data": [
{
"name": "作者",
"value": "AnqiCMS",
"default": ""
},
{
"name": "城市",
"value": "北京\n上海\n重庆\n广州\n天津",
"default": "北京\n上海\n重庆\n广州\n天津"
},
{
"name": "学历",
"value": "硕士\n本科\n大专\n高中\n初中",
"default": "硕士\n本科\n大专\n高中\n初中"
}
],
"msg": ""
}
When sorted is false, the value is returned
{
"code": 0,
"data": {
"author": {
"name": "作者",
"value": "AnqiCMS",
"default": ""
},
"certificate": {
"name": "学历",
"value": "硕士\n本科\n大专\n高中\n初中",
"default": "硕士\n本科\n大专\n高中\n初中"
},
"city": {
"name": "城市",
"value": "北京\n上海\n重庆\n广州\n天津",
"default": "北京\n上海\n重庆\n广州\n天津"
}
},
"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 |