HTTP Request Payload
The execution of Data Service logic is triggered automatically by an HTTP request incoming to the service endpoint. The contents of an HTTP request can be accessed using CTL functions. Request payload and request parameters are also accessible in component attributes.
Payload incoming in the request can be accessed using two approaches. One is by direct reading of an input stream using request:body as an input file URL of a reader component. If the request contains HTTP multipart message (e.g. multiple attachments), you can access individual payloads using request:part:[part_name] in the reader file URL.
Payload can also be accessed using the CTL function getRequestBody. The function however returns whole payload as string, so it is not recommended to use it for large payloads that may not fit in a memory.
Note: Payload stream can only be accessed once
when accessed via request:body or request:part:[part_name].
A second attempt to parse the stream will cause a failure.
By using the
getRequestBody() CTL function,
you may access the payload repeatedly, as the function will store the payload.