Document Content Query
💡 API calls require authentication. Refer to Interface Authentication for authentication
API Interface
POST {apiPrefix}/content/query
Submit document content query task
- If task addition fails, the failure reason is returned synchronously
- If task addition succeeds, the task ID is returned synchronously. Third parties can configure task callback notifications to get task status.
Request Body
Content-Type is application/json
| Parameter Name | Type | Description | Required |
|---|---|---|---|
| fileUrl | string | File download address | Yes |
| filename | string | Filename with extension | Yes |
| tokenType | string | Third-party token type, value is cookie or header | No |
| tokenValue | string | Third-party token value, passed back when zOffice downloads files or callback notifications | No |
| callback | string | Callback address. zOffice will callback to notify status after task completion | Yes |
| ops | array | Ordered operation array for document content queries, array objects see op description below. Supported operation list see Query List】 | Yes |
- For fileUrl/tokenType/tokenValue/callback description, see Common Field Description in this document
Request body example
{
"fileUrl": "http://{{thirdparty-demo}}/v2/context/local-PublicAPI-contentUpdate-clearDoc/content",
"filename": "demo-docx.docx",
"tokenType":"cookie",
"tokenValue":"zdocs_access_token={{zdocs_access_token}}",
"callback": "http://{{thirdparty-demo}}/v2/context/convert/callback",
"ops": [ {
"actId": "QueryBookmarkRef",
"options": {
"names": ["Bookmark One", "Bookmark Two"]
}
}]
}
Normal Response:
{
"taskId": "6f6598c8-c87e-420b-b6c4-6f1b187201dc",
"code": "Ok",
"detail": {
"taskStatus": "IN_QUEUE"
}
}
Error Response:
{
"taskId": "695fbf6e-90d2-42ba-83d5-00e81e5e366e",
"code": "TaskQueueCongestion",
"detail": {
"taskStatus": "FAIL"
}
}
Query List
Query Bookmark Area Content
Source file types support doc/docx/wps Source file maximum 300M
{
"actId": "QueryBookmarkRef",
"options": {
"names": ["Bookmark One", "Bookmark Two"]
}
}
options Description
| Option Name | Option Type | Required | Description |
|---|---|---|---|
| names | string[] | Yes | Array containing bookmark names |
Download result:
{
"Bookmark One": "Bookmark One Area Content",
"Bookmark Two": "Bookmark Two Area Content"
}
Note: Bookmarks that do not exist in the document will not appear in the result
Query Document Restrict Editing Status
Source file types support doc/docx/wps Source file maximum 300M
{
"actId": "QueryRestrictEditing",
"options": {}
}
Download result:
{
"enforcement": true,
"edit": "READ_ONLY"
}
| Option Name | Option Type | Required | Description |
|---|---|---|---|
| enforcement | boolean | Yes | Whether restrict editing is enabled |
| edit | string | No | Restrict editing type, values are READ_ONLY | ALLOW_ONLY_REVISIONS | ALLOW_ONLY_COMMENTS | ALLOW_ONLY_FORM_FIELDS |
Query Document Revision Count
Source file types support doc/docx/wps Source file maximum 300M
{
"actId": "QueryRevisionsCount",
}
Download result:
{
"revisionsCount": 1
}
| Option Name | Option Type | Required | Description |
|---|---|---|---|
| revisionsCount | int | Yes | Revision count |
Query Document Comments
Source file types support doc/docx/wps/xls/xlsx Source file maximum 300M, xlsx format 600M
{
"actId": "QueryComments",
}
Download result:
{
"commentsCount": 2,
"unresolvedCommentsCount": 1,
"comments": [{
"authorName": "Author",
"creationTime": 1724055042162,
"resolved": true,
"content": "Text",
"replies": [{...}] //Reply comments
}]
}
| Option Name | Option Type | Required | Description |
|---|---|---|---|
| commentsCount | int | Yes | Comment count |
| unresolvedCommentsCount | int | Yes | Unresolved comment count |
| comments | array | Yes | Comment information array |
Note: Reply comments are not counted in the count.
Comment Information:
| Option Name | Option Type | Required | Description |
|---|---|---|---|
| authorName | string | Yes | Author name |
| creationTime | number | Yes | Creation timestamp |
| resolved | boolean | Yes | Whether resolved |
| content | string | Yes | Comment content |
| replies | array | No | Reply comment array (fields same as comment information) |
Note: The resolved attribute of reply comments has no meaning, please focus on the resolved attribute of the main comment.