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)
- 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.
Note: Make sure that the request fields are completed correctly.
Type of action. Possible values:
|sessionId||int||Session ID (used for checking the user's permissions)|
Type of object on the server. Possible values
|objectId||int||Object ID (ID of a document, page, or task)|
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.
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
|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.
Loading a file from the server
To load a page file (objectType = 1) with ID id=4, streamName=C:\Temp\image.pdf and version=184201843 from the server, use the following POST request:
Saving a file on the server
To save a document (objectType = 0) with ID id=4, projectId=3, batchId=6, version=522, streamName=C:\Temp\image.pdf on the server, use the following POST request:
resp = FileRequest(
file: new ByteArrayContent(buffer, 0, readed),
For more information about POST request examples, see Examples.