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
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
Curl example of what I'm trying to do:
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