Skip to content

POST JSON data with cURL

Set your content-type to application/json, header as POST and your data.

curl -H "Content-Type: application/json" 
     -X POST 
     -d '{"username":"john","password":"john@98365"}' 
http://localhost:3350/api/login

If you want to POST a JSON from a file..

curl -X POST -H "Content-Type: application/json" -d @credentials.json http://localhost:3350/api/login
See also  Find the Running Median - Hackerrank Challenge - Java Solution

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.