Data Service that Receives a File or Text in Body Part

Data Services allows user to receive a file or a text in body part of an HTTP request and process it. The data is received using HTTP methods POST or PUT. Do not use the GET method to send a file to Data Service.

To read the body from request, drag an edge out of the body port of the Input component. A dialog to select a component will open. Select a reader from the list. The reader will appear in the graph pane and its File URL will be set to read data from the input port.

Reading body content from the port of Input component

Figure 52.1. Reading body content from the port of Input component

The input edge of the reader has metadata that is propagated out of the Input component. By default, the metadata is fixed and it has one byte metadata field. The size of the field is 1024B. If the file is bigger, the data is split into several records.

You can also set your own metadata to this edge. This metadata do not have to be fixed - it can be delimited or mixed - but it should contain one byte (or cbyte) or string metadata field. This field cannot be a list or a map. If you use mixed or delimited metadata, the whole body is conveyed in a single field of one record.

The rest of processing can be designed in the same way as an ordinary graph.

To test it, you can send a file to Data Service with curl.

curl -T fileName.xlsx URL

If your Data Service requires login, do not forget to provide credentials.

curl -T fileName.xlsx --user user:password URL