Working with Files
To exchange files with the Application Server, use a POST request.
To use an API, you must first connect to a Web service.
Types of actions
With the help of POST requests the following actions can be executed:
- Load files from server (Action = Load)
- Save files on the server (Action = Save)
- Append data to the end of the file (Action = Append)
- Getting a checksum for a file from the server (checksum is calculated using the CRC32 method) (Action = Checksum)
Possible use
- Importing images. Loading image files, also by parts and getting the checksum.
- Getting original page images at any time of processing.
- Working with attachments of batches, documents, pages (upload / download).
Note: For working with large attachments, POST requests should be used. Large files are divided into smaller parts and uploaded to server. If POST request is used to add an attachment to an object, the SaveAttachment method should be called after the POST request. As the file parameter of the SaveAttachment method, the zero-length file with the name of the transferred file is passed.
In other cases, it is recommended to use methods which are specially developed for working with attachments. - Getting XML description of the verification task, modifying this document and saving changes on the server.
Request parameters
Note: Make sure that the request fields are completed correctly.
Name | Type | Description |
Action | string |
Type of action. Possible values:
|
sessionId | int | Session ID (used for checking the user's permissions) |
projectId | int | Project ID |
batchId | int | Batch ID |
objectType | int |
Type of object on the server. Possible values
|
objectId | int | Object ID (ID of a document, page, or task) |
parentId | int |
The ID of the parent document Note: The parameter is specified for document sets. For documents that are not part of a set, the recommended value is 0. |
version | int | File version |
streamName | string |
The name of the Base64-encoded binary stream when saving a file to the server, or of the UrlEncode-encoded binary stream when loading a file from the server. Possible values for pages:
for documents:
for tasks:
|
blob | Binary file data (if the Action parameter is set to Save or Append) | |
offset | int | The offset from the start of the file after which to append the data (if the Action parameter is set to Append) |
File Storage contains all files of the project. The file name contains information about the type of object, its identifier, name of the stream in the form of: <object type>-<object id>-<stream name>version.
Files of pages (objectType = 1) contain copies of images while document files (objectType = 0) contain source images. Thus, you cannot change an image using the POST request with the parameter: objectType = 1.
Example requests
Loading a file from the server
Saving a file on the server
For more information about POST request examples, see Examples.
12.04.2024 18:16:02