Skip to content

Send file via multi-part HTTP-request with additional form data #728

Description

@Hooghof

As a user I want to send a file via a multi-part HTTP request with additional form data, so that I can send additional options with my request

We already have a multipart component that lets the user specify a form field name that it will use to put the binary data on. There is no option to send additional form fields with text data. The IBM docling API I’m working with accepts options that are set on a secondary field.

Acceptance criteria

  • I can add multiple text fields (key/value) to the multipart component
  • These text fields are sent to the HTTP endpoint along with the file

Curl example of what I'm trying to do:

curl --location 'https://api.aws-c1.dcls.saas.ibm.com/20260818-0920-0317-4058-81eff2a1e2dd/v1/convert/file/async' \
--header 'X-Api-Key: obfuscated' \
--header 'Cookie: obfuscated' \
--form 'files=@"/path/to/my/project/ai-document-matching/assets/PO-40085-fedex-300dpi.pdf"' \
--form 'options="{\"to_formats\": [\"md\"],\"force_ocr\":true}"'

Out of curiosity I looked at the code of the custom multipart component. custom-components/multipart/src/main/java/org/assimbly/multipart/processor/MultipartProcessor.java at develop · assimbly/custom-components

I imagine that the component translates a map of the provided extra keys to extra parts for the entity:
entity.addPart(keyName, new StringBody(keyValue, ContentType.TEXT_PLAIN));

https://dovetailworld.atlassian.net/browse/FG-2636

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions