curl --header "Content-Type: application/json" \ --request POST \ --data '{"name": "Desmond Lua", "age": 40}' \ [URL]
or
curl -X POST -d '{"name": "Desmond Lua", "age": 40}' -H "Content-Type:application/json" [URL]
Send JSON from file
curl -X POST -d @test.json -H "Content-Type: application/json" [URL]
**NOTE:** If you test REST api frequently, do consider tools like [Postman or Insomnia][tools-to-test-rest-api]
[tools-to-test-rest-api]: /tutorials/linux/tools-to-test-rest-api/