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…!!