API call description
- After the call succeeds, you can call the API for setting filter criteria to configure filter rules for each column. Records that do not meet the criteria are automatically hidden.
- Each worksheet can have only one global filter. If a filter already exists, an error is returned.
Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/doc/workbooks/{workbookId}/sheets/{sheetId}/createFilter |
| HTTP Method | POST |
| Supported app type | appType-Internal app |
| Permissions | permission-Document.Workbook.Write-DingTalk Spreadsheet write permission |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Call the Get the access token of an internal app API to obtain it. |
Path parameter
| Name | Type | Required | Description |
|---|---|---|---|
| workbookId | String | Yes | The spreadsheet file ID. The nodeId(dentryUuid) returned by the Knowledge Base API is the workbookId of the spreadsheet. You can call the Get node and Create knowledge base document APIs to obtain it. |
| sheetId | String | Yes | The ID or name of the worksheet. Call the Get all worksheets API to obtain the value of the id or name parameter. |
Query parameter
| Name | Type | Required | Description |
|---|---|---|---|
| operatorId | String | Yes | The unionId of the operator. - Call the Get user information by silent login code API to obtain the value of the unionid parameter. - Call the Query user details API to obtain the value of the unionid parameter. If the operator has no permission, the API returns the error The operator has no permission. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| range | String | Yes | The filter range, in A1 notation. For example, A1:D10 indicates the area from A1 to D10. The first record of the filter range is treated as the title record and is not included in the filter calculation. |
| criteria | Map<String, Object> | No | Optional. Sets the filter criteria for each column when creating the filter. The key is the column offset (a string starting from 0, relative to the primary field of the filter range), and the value is the filter criteria object (FilterCriteria) for that column. If not provided, an empty filter is created. |
| Object | No | The filter criteria for the current column. | |
| filterType | String | No | The filter type. Valid values: - values: Filter by values. - color: Filter by color. - condition: Filter by condition. |
| visibleValues | Array of String | No | The visible values. |
| conditions | Array | No | The array of filter conditions. A maximum of 2 conditions is allowed. Required only when filterType is condition. |
| operator | String | No | The condition operator. Valid values: - equal: Equal to. - not-equal: Not equal to. - contains: Contains. - not-contains: Does not contain. - starts-with: Starts with. - not-starts-with: Does not start with. - ends-with: Ends with. - not-ends-with: Does not end with. - greater: Greater than. - greater-equal: Greater than or equal to. - less: Less than. - less-equal: Less than or equal to. |
| value | String | No | The condition value. |
| conditionOperator | String | No | The relationship between multiple conditions: "and" (default) or "or". Required only when filterType is condition. |
| backgroundColor | String | No | Filter by background color. A hexadecimal color value, such as "#FF0000". Required only when filterType is color. |
| fontColor | String | No | Filter by font color. A hexadecimal color value, such as "#0000FF". Required only when filterType is color. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| id | String | Id of the request |
Response body example
Error codes
If an error is returned when you call this API, find the solution in the Global error codes document based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | invalidRequest.inputArgs.invalid | %s | Invalid request parameters. Refer to the error message. |
| 400 | invalidRequest.inputArgs.workbookIdIllegal | The workbookId is illegal. | The workbookId is invalid. |
| 400 | invalidRequest.resource.notWorkbook | %s | Unsupported document type. Check the workbookId. |
| 400 | invalidRequest.document.stillInitializing | The document is still initializing. Please try again later. | The document is initializing. Try again later. |
| 403 | forbidden.accessDenied | The operator has no permission. | The current user does not have permission for this action. |
| 403 | forbidden.acrossOrg | %s | Invalid request. Check whether the document to access belongs to the organization specified by the access token. |
| 403 | forbidden.operationIllegal | %s | Invalid request action. Refer to the error message. |
| 403 | forbidden.document.sizeOverLimit | The document size is over limit and the server is unable to complete your request. Retry is unlikely to work unless the document size is decreased. | The spreadsheet content is too large. Try reducing the content. |
| 404 | invalidRequest.resource.notFound | %s | The request failed. The resource to access cannot be found. |
| 500 | serviceBusy | The server is busy and unable to complete your request. Please try again later. | The service is busy. Try again later. |
| 500 | internalError | The server encountered an internal error and was unable to complete your request. Please try again later. | An internal service error occurred. Try again later. |