We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

cURL POST Request

Making a POST request with cURL is almost as simple as a GET request. Use the -X POST option (not -x) to specify the request method and the -d option to pass data.

Here's how to make a POST request:

curl -X POST http://example.com/resource -d "param1=value1&param2=value2"

This command makes an HTTP POST request to http://example.com/resource with the data param1=value1&param2=value2. The server's response body is written to stdout.

If you need to send JSON data, use the -H option to set the Content-Type header and the -d option to pass the JSON data:

curl -X POST http://example.com/resource -H "Content-Type: application/json" -d '{"key1":"value1","key2":"value2"}'

Assignment

https://api.boot.dev/v1/courses_rest_api/learn-http/users
{
  "role": "QA Job Safety",
  "experience": 2,
  "remote": true,
  "user": {
    "name": "Dan",
    "location": "NOR",
    "age": 29
  }
}

Run and submit the CLI tests.

The JSON payload has to be surrounded by single quotes to ensure that the shell correctly interprets the payload.