0
0
Linux CLIscripting~10 mins

curl for HTTP requests in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send a simple GET request to example.com using curl.

Linux CLI
curl [1]
Drag options to blanks, or click blank then click option'
A-d 'data' http://example.com
B-X POST http://example.com
Chttp://example.com
D-I http://example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using -X POST when you want a GET request.
Adding data (-d) when not needed.
Using -I which only fetches headers.
2fill in blank
medium

Complete the code to send a POST request with curl to http://example.com.

Linux CLI
curl [1] http://example.com
Drag options to blanks, or click blank then click option'
A-X GET
B-X POST
C-L
D-I
Attempts:
3 left
💡 Hint
Common Mistakes
Using -X GET instead of POST.
Using -I which only fetches headers.
Using -L which follows redirects but does not change method.
3fill in blank
hard

Fix the error in the curl command to send JSON data with POST to http://example.com.

Linux CLI
curl -X POST -H 'Content-Type: application/json' -d [1] http://example.com
Drag options to blanks, or click blank then click option'
A"name=John"
B{"name":"John"}
C'name=John'
D'{"name":"John"}'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting JSON properly causing shell errors.
Using URL-encoded format instead of JSON.
Missing quotes causing syntax errors.
4fill in blank
hard

Fill both blanks to save the output of a curl GET request to a file named response.txt.

Linux CLI
curl [1] [2]
Drag options to blanks, or click blank then click option'
A-o response.txt
Bhttp://example.com
C-O
D-I
Attempts:
3 left
💡 Hint
Common Mistakes
Using -I which only fetches headers.
Using -O which saves with original filename, not custom.
Putting options in wrong order.
5fill in blank
hard

Fill all three blanks to send a POST request with JSON data and include a custom header.

Linux CLI
curl [1] -H [2] -d [3] http://example.com
Drag options to blanks, or click blank then click option'
A-X POST
B'Authorization: Bearer token123'
C'{"id":5}'
D-I
Attempts:
3 left
💡 Hint
Common Mistakes
Using -I which only fetches headers.
Not quoting header or data properly.
Missing -X POST option.