English
List Knowledge Entries (Query by Condition)
About 818 wordsAbout 3 min
2026-09-14
Description
Queries knowledge entries with pagination in the standard object-query manner: the query DSL (search_query_info) supports filtering, sorting and field projection over fields such as title, folder, publish status and update time.
This API is the platform standard object-query API; the object is specified via dataObjectApiName, with a fixed value of ServiceKnowledgeObj.
Request Specification
HTTP Method: POST + application/json
Request Path: https://${Cloud Domain}/cgi/crm/v2/data/query?thirdTraceId=${Random String}
Request Headers: Refer to Common Parameters
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| returnTotalNum | Int | No | Total count type: 1 exact total, 2 estimated total, 3 no total (faster); when omitted the platform default applies — pass explicitly as needed |
| includeNull | Boolean | No | Whether to include null fields; false omits them, true returns them; defaults to false |
| data | Map | Yes | Data |
| dataObjectApiName | String | Yes | Object apiName, fixed value ServiceKnowledgeObj |
| search_query_info | Map | Yes | Query Condition Guide |
| limit | Int | Yes | Page size (max 100) |
| offset | Int | No | Offset, starting at 0; defaults to 0 when omitted |
| filters | List | No | List of filter conditions |
| field_name | String | Yes | apiName of the filtered field |
| field_values | List[String] | Yes | Field values |
| operator | String | Yes | Operator; see the operator table below |
| orders | List | No | Sort conditions |
| fieldName | String | Yes | Field apiName |
| isAsc | Boolean | No | Whether ascending; defaults to false (descending) when omitted |
| fieldProjection | List[String] | Yes | Returned field list; values are field apiNames |
operator parameters
Query conditions from the object list page can be reused directly; see How to obtain list query conditions
| Parameter | Meaning | Notes | Parameter | Meaning | Notes |
|---|---|---|---|---|---|
| EQ | equals | N | not equals | matches null values too | |
| GT | greater than | GTE | greater than or equal to | ||
| LT | less than | LTE | less than or equal to | ||
| LIKE | contains | NLIKE | does not contain | ||
| IS | is null | ISN | is not null | ||
| IN | belongs to | NIN | does not belong to | ||
| BETWEEN | between | NBETWEEN | not between | ||
| STARTWITH | starts with | ENDWITH | ends with | ||
| HASANYOF | has overlap | NHASANYOF | no overlap |
Common filter recipes for knowledge entries
| Scenario | Filter |
|---|---|
| Entries in a given folder | field_name=category, operator=IN, field_values = folder code list |
| A folder and all its sub-folders | Expand sub-folders level by level via List Visible Knowledge Folders using hasChildren, then IN-filter all codes together (category matches the folder itself only; sub-folders are not included automatically) |
| Title keyword search | field_name=title, operator=LIKE, field_values = keyword |
| Published entries only | field_name=public_status, operator=EQ, field_values=["1"]; see Publish Knowledge Entry for status values |
| Update time range | field_name=last_modified_time, operator=BETWEEN, field_values = start/end millisecond timestamps |
Request Example
{
"returnTotalNum": 1,
"data": {
"dataObjectApiName": "ServiceKnowledgeObj",
"search_query_info": {
"offset": 0,
"limit": 20,
"orders": [
{ "fieldName": "last_modified_time", "isAsc": false }
],
"fieldProjection": ["_id", "title", "category", "summary", "public_status", "content_type", "last_modified_time"],
"filters": [
{ "field_name": "category", "operator": "IN", "field_values": ["16", "17"] },
{ "field_name": "public_status", "operator": "EQ", "field_values": ["1"] }
]
}
}
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| traceId | string | Unique request ID |
| errorDescription | string | Error description |
| errorMessage | string | Error message |
| errorCode | Int | Error Codes |
| data | Map | Response data |
| total | Int | Total number of matching entries (returned when returnTotalNum is 1/2) |
| dataList | Array | Knowledge entries of the current page; the fields are determined by fieldProjection |
| dataList[]._id | String | Knowledge entry ID |
| dataList[].title | String | Title |
| dataList[].category | String | Code of the owning knowledge folder |
| dataList[].summary | String | Summary |
| dataList[].public_status | String | Publish status |
| dataList[].content_type | String | Content type |
| dataList[].last_modified_time | Long | Last update time, in milliseconds |
Response Example
{
"traceId": "E-O.fktest4234.1000-20260914105000-xxxxxx",
"errorDescription": "success",
"errorMessage": "OK",
"errorCode": 0,
"data": {
"total": 1,
"dataList": [
{
"_id": "68c1a0f0abcd0001",
"title": "Device Installation Guide",
"category": "16",
"summary": "Standard installation steps",
"public_status": "1",
"content_type": "rich_text",
"last_modified_time": 1757772000000
}
]
}
}Notes
- This API exposes the query DSL directly; field names used in filters/sorting/projection are field apiNames. Obtain the field list via the object description; refer to Parameter Filling Guide.
- The
categoryfilter matches the folder itself only and does not include sub-folders; to query a folder together with its sub-folders, expand the sub-folder codes first and useIN. - Sorting must be specified explicitly via
orders(e.g.last_modified_timedescending); the default order is not guaranteed. - Only non-invalidated data within the current user's permission scope is returned; invalidated (recycled) data is excluded by default.
- A field whose value is empty is omitted from the response (pass
includeNull=trueto keep null fields). - Beware of deep pagination when combining
offsetandlimit. - Do not use the message field in the response for logical judgment, as errorMessage may change.
