Forum Discussion
vaidyarm,
You can do this with a triggered task, but need to make sure there is only a binary view open, otherwise it will fail with the error:
Document input views only accept JSON-encoded data
SnapLogic has two types of input views: document and binary. The document input views are used for structured or semi-structured data like Json, XML, CSV, etc. Document input views are represented by a Snap with an open circle like this.
For your use case, the request will be multipart-form-data and so the pipeline should have a binary input view. Specifically you should use a Multipart Reader that will be able to extract the binary data from the POST request. The binary input view is an open diamond.
Here’s an example of a Pipeline that takes the POSTed file and stores it in SLFS using the Multipart Reader and the File Writer. You can try it out by importing this pipeline, creating a triggered task, and then using Postman/curl to send a file to the task endpoint. You should see the file you sent written to a file named ‘attachment.txt’ in the same project as the pipeline.
post-file-example_2019_10_04.slp (4.3 KB)
that really helped !!! i am able to transfer all kind of posted files now wherever I need to send it.
but there is one thing that i have to pass in API requested along with the attachment, the name of the file in the query field. then i map this pipeline parameter to the filename in file writer
is there a way where i can simply provide attachment and auth details to the REST POST API and pipeline should extract the name from it in form of some variable which we can map as the file name in file writer snap ?