Ingesting Direct REST Requests with Binary Payloads
You can ingest requests with Binary‑formatted payloads in Direct REST methods.
To enable this functionality, you must have a REST method that has a Binary primitive as one of the parameters, the value of the
The format of the request payload is determined by examining the value of the "Content‑Type" header field. If any of the values "image", "audio", "video", "pdf", or "octet-stream" is present in the header field value, the payload will be considered to be in a binary format.
When receiving a REST request with a Binary payload, for example, it can be formatted as follows.
POST /image HTTP/1.1 Content-Type: image/png Content-Length: 831153
<Binary data>
The binary payload to the first Binary parameter in the REST method signature can be mapped, so the above request could be ingested by a REST method like the following example, which takes the payload and writes it to a file on disk (assuming that is both safe and something that you want to do with the binary payload).
postImage(image: Binary): String;
vars
file : File;
begin
create file transient;
file.mode := File.Mode_Output;
file.kind := File.Kind_Binary;
file.fileName := "<path to file>";
file.writeBinary(image);
epilog
delete file;
end;
2025.0.01 and higher
