Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to send a GET request to example.com using curl.
Bash Scripting
curl [1] https://example.com Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using -X POST instead of -X GET causes the server to expect data submission.
Using -d without data causes errors.
Using -I only fetches headers, not the full response.
✗ Incorrect
The -X GET option tells curl to send a GET request, which is the default method to retrieve data.
2fill in blank
mediumComplete the code to include a JSON content type header in the curl request.
Bash Scripting
curl -X POST [1] -d '{"name":"John"}' https://example.com/api
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong Content-Type header causes the server to misinterpret the data.
Forgetting to add the header can cause the server to reject the request.
✗ Incorrect
The header 'Content-Type: application/json' tells the server that the data sent is in JSON format.
3fill in blank
hardFix the error in the curl command to correctly send a POST request with JSON data.
Bash Scripting
curl -X POST -d [1] https://example.com/api Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using key=value format instead of JSON.
Using double quotes outside without escaping causes shell errors.
✗ Incorrect
JSON data must be enclosed in single quotes with double quotes inside to be valid and correctly parsed.
4fill in blank
hardFill both blanks to save the response headers to a file and the body to another file.
Bash Scripting
curl -D [1] -o [2] https://example.com/api
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing -D and -o options.
Saving both headers and body to the same file.
✗ Incorrect
The -D option saves headers to a file, and -o saves the response body to a file.
5fill in blank
hardFill all three blanks to create a curl command that sends a DELETE request with an authorization header and verbose output.
Bash Scripting
curl [1] [2] [3] https://example.com/api/item/123
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to specify the DELETE method.
Not including the authorization header.
Missing verbose flag for debugging.
✗ Incorrect
Use -X DELETE to specify the method, -H to add the auth header, and -v for verbose output.