

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Install cURL
incomplete
2: cURL Basics
incomplete
3: cURL POST Request
incomplete
4: Install jq
incomplete
5: jq Basics
incomplete
This lesson's interactive features are locked, please to keep using them
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¶m2=value2"
This command makes an HTTP POST request to http://example.com/resource with the data param1=value1¶m2=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"}'
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.