I am sending one .txt file from POSTMAN that has content separated by delimiter (flat file). I want to accept that file on IS through a rest service(post). I have tried the approach of sending the content of the file in a json object and that worked properly. But, I want to send that file itself to the rest service instead of sending the file’s content in json.
If I read this right, this is a Postman question rather than IS, since you’re asking about how to “send” the file.
Try out the second answer in this link.
May be I haven’t framed this question properly. let me reframe it again.
it doesn’t matter from where i am receiving the file. it could be postman or the dsp page. I want to know how can i receive that file on IS. basically if i expose a rest service and some client is sending me a text file then how we can handle that file on IS. how do we read the content of that file.
Simply specify a content type of “text/plain”, change your service signature to “contentStream”.
Use the service “pub.io:streamToString” to convert the stream to a string, or pipe the stream through the service “pub.flatFile:convertToValues” if you have a flat file schema.
Be careful if the file content is large do not use streamToString, it will explode your memory if too big. In which case use the flat file process as above using the iterator input.
awesome, its working !
John, I used the input signature as contentStream and it worked. But, when you change the name of the input signature from contentStream to something else. it doesn’t work. I just want to know why is it so. If you can tell the logic/reason then it will be really helpful.