cURL post JSON data on Windows

On Windows, the key to send JSON data is double-quotes like this -d "{\"name\":\"Spring Forever\"}" cURL to POST a JSON data curl -X POST localhost:8080/books -H "Content-type:application/json" -d "{\"name\":\"Spring Forever\",\"author\":\"pivotal\"}" References cURL – Post JSON data to Spring REST

cURL – PUT request examples

Example to use cURL -X PUT to send a PUT (update) request to update the user’s name and email. Terminal $ curl -X PUT -d ‘name=mkyong&[email protected]’ http://localhost:8080/user/100 If the REST API only accepts json formatted data, try this Terminal $ curl -X PUT -H "Content-Type: application/json" -d ‘{"name":"mkyong","email":"[email protected]"}’ http://localhost:8080/user/100 References cURL official website cURL – …

Read more

cURL – DELETE request examples

To send a DELETE request, uses cURL -X DELETE Terminal $ curl -X DELETE http://localhost:8080/user/100 The above example will delete a user where user id is 100. References cURL official website cURL – POST request examples