Skip to main content

Overview

For completed file split tasks, if the category of split child files is incorrect or you need to adjust the page range of child files, you can use the amend category API to modify the category and page numbers of split files.
This API is used to modify the category and page numbers of child files generated by file split tasks (task_type = 2, parent task). You need to first obtain the parent task’s task_id.

Use Cases

  1. Split Category Correction: After automatic splitting, some child files have incorrect category recognition and need manual correction
  2. Page Range Adjustment: The page range of split files needs adjustment, such as merging or re-dividing multiple child files

API Endpoint

Endpoint: POST /api/app-api/sip/platform/v2/file/amend_category

Request Parameters

split_tasks Parameter Description

Parameter Description

  • task_id: Parent task ID (task_type = 2), can be obtained through the file/fetch API
  • category: New file category name, must be a file category already configured in the DocFlow workspace. If a child file doesn’t need category modification, you can keep the original category unchanged
  • pages: Page number array indicating the original file pages contained in this child file. For example, [0, 1] means pages 1 and 2 (starting from 0). If a child file doesn’t need page number modification, you can keep the original page numbers unchanged
Important: The split_tasks array must contain all split child file information, even if some child files don’t need category or page number modifications. If only partial child file information is submitted, the unlisted child files will be deleted or cause processing exceptions.

Example Code

Get Parent Task ID and Child File Information

Before modifying the file category, you need to obtain the parent task’s task_id and child file information. You can query it through the file/fetch API:

Response

After successfully modifying the file category, the API returns a success response:

Complete Example

The following is a complete example showing how to query file split task information and then modify child file categories and page numbers:
Python

Page Number Notes

  • Page numbers start from 0, meaning page 1 corresponds to page number 0, page 2 corresponds to page number 1, and so on
  • The pages array indicates the original file page numbers contained in this child file

Notes

  1. Must Include All Child Files: The split_tasks array must contain all split child file information, even if some child files don’t need category or page number modifications. If only partial child file information is submitted, the unlisted child files will be deleted or cause processing exceptions
  2. Task Type Restriction: Only file split parent tasks (task_type = 2) support using the split_tasks parameter
  3. Category Must Exist: The specified category must already be configured in the DocFlow workspace, otherwise an error will be returned
  4. Category Name Matching: Category names must exactly match the configuration (case-sensitive)
  5. Page Range: Ensure page numbers in the pages array are within valid range (0 to total pages - 1), and page numbers cannot be duplicated
  6. No Duplicate Pages: Each page number can only appear in one child file, no overlapping allowed
  7. Reprocessing After Modification: After modifying file categories and page numbers, the system will reprocess data according to the new categories and page ranges