Convert Postman Successful JSON command to Successful cURL command

I have a command that works successfully in Postman:

Method: POST
Address: 192.168.1.83:8080/jsonrpc
Body: {ā€œjsonrpcā€: ā€œ2.0ā€, ā€œmethodā€: ā€œInput.Upā€, ā€œidā€: 1}
Type: JSON (application/json)

A screenshot of this is in this image album https://imgur.com/a/iPKqA

It does what I want and returns a success message ({ā€œidā€:1,ā€œjsonrpcā€:ā€œ2.0ā€,ā€œresultā€:ā€œOKā€}).

If I click the Code button by the right margin,

Partial screenshot in album.

it gives me several ways to see the code that Postman is generating.

Partial screenshot in album.

I choose cURL

Partial screenshot in album.

and it gives me this code

curl -X POST
http://192.168.1.83:8080/jsonrpc
-H ā€˜Cache-Control: no-cacheā€™
-H ā€˜Content-Type: application/jsonā€™
-H ā€˜Postman-Token: 82ec87fb-667f-a0fe-182e-9621199274aeā€™
-d ā€™ {ā€œjsonrpcā€: ā€œ2.0ā€, ā€œmethodā€: ā€œInput.Upā€, ā€œidā€: 1}ā€™

Partial screenshot in album.

When I try to use that code at a Windows command prompt, it doesnā€™t work

Partial screenshot in album.

How can I generate a code snippet that I can run from a Windows command prompt that will work?

You have to install curl on your Windows box. I found this on stack overflow ā€¦

  1. Visit download page https://curl.haxx.se/download.html - itā€™s incredible
  2. Choose your sytem in list
  3. Donā€™t forget SSL support, itā€™s obvious now, e.g. for https
  4. Unpack curl.exe and .crt to C:\Windows\System32
  5. Restart cmd
  6. Enjoy > curl https://api.stackexchange.com
  7. p.s. If you want another folder to store executable check your paths > echo %PATH%

Thank you. Iā€™d actually already installed Curl and had been running it before trying Postman. My frustration is that there are commands that I can run successfully in Postman that I cannot figure out how to run using curl.exe at the Windows command prompt. Iā€™m trying to move from the (wonderful) environment of Postman holding my hand and making everything easy to the quick and dirty world of command line.

If you know how to convert a Postman command into one I can run at the command line using curl.exe, please comment.

from the attached image i can say your curl command should be in one single line(can include space not enter)

curl -X POST http://192.168.1.83:8080/jsonrpc -H ā€˜Cache-Control: no-cacheā€™ -H ā€˜Content-Type: application/jsonā€™ -H ā€˜Postman-Token: 82ec87fb-667f-a0fe-182e-9621199274aeā€™ -d ā€™ {ā€œjsonrpcā€: ā€œ2.0ā€, ā€œmethodā€: ā€œInput.Upā€, ā€œidā€: 1}ā€™

1 Like

How to do the same thing in the mac terminal.?

Please help me outā€¦!!