mortsahl
mortsahl

Reputation: 602

Works with CURL how to format for Postman/REST client

I'm sure this is a dumb question but I haven't been able to see the light.

If I have a curl command ...

curl -v  -F "dataType=dws" -F "format=csv" -F "compression=gzip" -F "sha256sum=17685b28be3af7b71bcab78c0393d548d7cd563f3fd5d955309c9512a4ad28ad" -F "file=@/Users/xxx/sql/file.gz" http://localhost:8080/p20/fileUpload

that works perfectly, how do I do the same thing via Postman(or any REST client) ?

Thanks in advance for enlightening me.

Upvotes: 0

Views: 1852

Answers (2)

Pavan Vegirouthu
Pavan Vegirouthu

Reputation: 101

There is an excellent blog post on Postman.com that gives detailed step by step instructions to turn on verbose mode in postman application. This allows you to observe raw HTTP requests and also do much more debugging.

Upvotes: 0

Peter Paul Kiefer
Peter Paul Kiefer

Reputation: 2124

t-F means Formdata. Normally used for the data from the form fields of a HTML page, which are typically submitted by an POST Request to the server. Curl builds a data string and send it in the body of the HTTP request. An equivalent to your curl statement is:

curl -v -X POST -d "dataType=dws&format=csv&compression=gzip&sha256sum=17685b28be3af7b71bcab78c0393d548d7cd563f3fd5d955309c9512a4ad28ad&file=@/Users/xxx/sql/file.gz" http://localhost:8080/p20/fileUpload

curl treats the file=@... as a special command. It reads the file and appends the content to the body. It also set the mime type to multipart/formdata.

Thats all you must do in postman or equivalent. Enter the string after -d in the body/content field. Set the method to POST. Enter the URL.

-v increases the verbosity level. I don't know how to make postman more verbose.

Upvotes: 1

Related Questions