File Management
Before processing your file with Zuva, you first need to upload it and obtain a file ID to use in your subsequent requests.
Using this guide
This guide uses plain Python 3 and built-in libraries here for illustrative purposes, but if you plan to use Python in your own code you may want to check out our prebuilt Python wrapper.
To run the code samples, you’ll need the following imports and constants:
|
|
Step 1: Upload a file to Zuva
Make a POST request to the ‘files’ API to upload your file using the following function:
|
|
Specifying content-type
The content type can be omitted (defaulting to application/octet-stream
) for most file types. However, the content type application/eocr
must be specified for
eOCR documents. It is also a good practise to explicitly declare the content type of text files (plain/text
) and PDF files (application/pdf
).
Specifying expiration
The expiration time of the file may be specified using the Expiration
request header, as either an absolute timestamp (e.g. 2022-12-23T12:34:56Z
) or an interval (e.g 12h
or 10d
). The maximum allowed value is 14 days.
Step 2 (optional): File validation
If desired, you can check the sha-256 hash to ensure the integrity of your uploaded file.
The hash can be found from the Submit File response:
|
|
You can also find the sha-256 hash using your operating system’s native tools:
MacOS/Linux
|
|
Windows PowerShell
|
|
Step 3: Process a file
Get the file_id
from the response for use in any of the other workflows: classification, language, field extraction, OCR and training.
|
|
Step 4 (Optional): Delete a file from Zuva
Files uploaded to Zuva are automatically deleted after 48 hours. However, if you would like to delete the file sooner, you can use the Delete file endpoint as follows:
|
|
On This Page