Recall & Review
beginner
What is the basic command to make a GET request using curl?
The basic command is
curl URL. This sends a GET request to the URL and shows the response.Click to reveal answer
beginner
How do you include headers in a curl request?
Use the
-H option followed by the header in quotes. Example: curl -H "Content-Type: application/json" URL.Click to reveal answer
beginner
How can you send data with a POST request using curl?
Use
-d to send data and -X POST to specify POST method. Example: curl -X POST -d "name=John" URL.Click to reveal answer
beginner
What option makes curl silent, so it doesn't show progress or errors?
Use
-s or --silent. This is useful in scripts to avoid clutter.Click to reveal answer
beginner
How do you save the response of a curl request to a file?
Use
-o filename to save the output to a file. Example: curl URL -o response.txt.Click to reveal answer
Which curl option is used to add a custom header to an HTTP request?
✗ Incorrect
The
-H option adds headers like Content-Type or Authorization.What does the
-d option do in a curl command?✗ Incorrect
-d sends data, usually with POST or PUT requests.How do you specify a POST request explicitly with curl?
✗ Incorrect
-X POST tells curl to use the POST method.Which option saves the response to a file?
✗ Incorrect
-o followed by a filename saves the output to that file.What does the
-s option do in curl?✗ Incorrect
-s makes curl silent, useful in scripts to avoid extra output.Explain how to make a POST request with JSON data using curl in a script.
Think about method, headers, and data options.
You got /4 concepts.
Describe how to save the output of a curl HTTP GET request to a file silently.
Combine silent mode and output file options.
You got /4 concepts.