REST API provider for binary attachments

I have created a REST API function that receives binary content and metadata:

Using this function I can receive BASE64 encoded binary data (Document). Two questions on this:

1. What is the length limit for these BASE64 encoded strings?

2. Is there any other way to pass in binary data together with the relevant metadata like using mutilpart/form-data without BASE64 encoding?

Thank you very much.

Best regards

Hello Matthias Haase,

A base 64 encoded string will use 4 characters for every 3 bytes (or part thereof). Regarding max length, for example using SQL server 12 the max length is 4000 Character for text data type.

From theorical point of view, You have base85 which represents four bytes as five characters. However, this is only a 7% improvement over base64, and it's more expensive to compute.

All the best

Hello Ricardo Cruz,

Thank you very much for your answer. Currently the attribute for the binary data is in the service structure and also in the database defined as binary data datatype, not string. So I think the length restrictions for string type attributes should not have any effect on these fields, is that right?

As far as I know the conversion from BASE 64 binary encoded content sent to the service to binary data is automatically done by the Outsystems platform. So my question is whether there are length restrictions for this automatic conversion.

The other question was regarding avoiding encoding by algorithms like BASE 64. Using for example multipart/form-data strcutures in a request it should be possible to send binary data without any encoding.

Best regards