DEV Community

Na Nashi
Na Nashi

Posted on

CURL to Test REST API

curl -X GET -v http://localhost:8000/home
Enter fullscreen mode Exit fullscreen mode

-X to specify a HTTP method and -v to display headers (verbose)

curl -X POST \
     -H "Content-Type: application/json" \
     -d '{"username":"xyz","password":"xyz"}' \
     -v http://localhost:8000/home/create
Enter fullscreen mode Exit fullscreen mode

-H for headers, -d for data (e.g. JSON or XML)

Top comments (0)