Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 1.77 KB

making-requests.md

File metadata and controls

58 lines (35 loc) · 1.77 KB

Making Requests

The Unstructured API takes multipart form requests. There are currently two types of requests one can make with the Unstructured4s client:

partition

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 type UnstructuredFile, just an opaque type for java.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 custom sttp headers to be sent with the request. These will override any default headers including the unstructured-api-key header.

A hopefully sensible default with all necessary parameters for each is provided in api client.


GeneralRequestFields

@@snip domain.scala { #general_request_fields }


HiResRequestFields

@@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 type Seq[UnstructuredFile]

Similarly:

response = client.partitionMultiple(files) // can provide a request and headers here as well