The Unstructured API takes multipart form requests. There are currently two types of requests one can make with the Unstructured4s client:
The partition
request is used to send one file to be partitioned by Unstructured.io. The request takes three
parameters, only one of which does not have a default value:
file
- The file to be partitioned, of typeUnstructuredFile
, just anopaque type
forjava.io.File
request
-Unstructured4sRequestFields
The request fields to be sent to Unstructured.io. These can be of two types:GeneralRequestFields
HiResRequestFields
customHeaders
-List[Header]
- A list of customsttp
headers to be sent with the request. These will override any default headers including theunstructured-api-key
header.
A hopefully sensible default with all necessary parameters for each is provided in api client.
@@snip domain.scala { #general_request_fields }
@@snip domain.scala { #hires_request_fields }
Then to make the request:
response = client.partition(file) // can provide a request and headers here as well
## partitionMultiple
The partitionMultiple
request is used to send many files to be partitioned by Unstructured.io. It is the same as the
partition
request except that
files
- The files to be partitioned, of typeSeq[UnstructuredFile]
Similarly:
response = client.partitionMultiple(files) // can provide a request and headers here as well