Vishnu Ranganathan Vishnu Ranganathan - 1 year ago 88
JSON Question

How to make a POST call with JSON data using curl?

I have tried only GET calls using curl, and now I need to make a POST call. I need to give the parameters or input using JSON. How do I write this command?

Answer Source

Assuming you are asking how to format a curl POST request with JSON attributes.

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d "{'json':{'key':'value'}}" http://your.domain/endpoint/here

This page covers a lot of useful cases.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download