0
0
IOT Protocolsdevops~10 mins

HTTP request methods for IoT (GET, POST, PUT) in IOT Protocols - 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 request that retrieves data from a device.

IOT Protocols
http_request.method = "[1]"
Drag options to blanks, or click blank then click option'
AGET
BPOST
CPUT
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST instead of GET to retrieve data.
2fill in blank
medium

Complete the code to send data to a device to create a new resource.

IOT Protocols
http_request.method = "[1]"
Drag options to blanks, or click blank then click option'
APOST
BGET
CPUT
DPATCH
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing POST with GET or PUT methods.
3fill in blank
hard

Fix the error in the code to update an existing device resource.

IOT Protocols
http_request.method = "[1]"
Drag options to blanks, or click blank then click option'
APOST
BGET
CDELETE
DPUT
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST instead of PUT to update data.
4fill in blank
hard

Fill both blanks to complete the code that sends data to update a device resource.

IOT Protocols
http_request.method = "[1]"
http_request.payload = [2]
Drag options to blanks, or click blank then click option'
APUT
B{"temperature": 22}
CGET
D{"status": "on"}
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET method with a payload, which is not standard.
5fill in blank
hard

Fill all three blanks to create a POST request with a JSON payload to add a new device setting.

IOT Protocols
http_request.method = "[1]"
http_request.headers = {"Content-Type": "[2]"}
http_request.payload = [3]
Drag options to blanks, or click blank then click option'
APOST
Bapplication/json
C{"mode": "eco"}
DPUT
Attempts:
3 left
💡 Hint
Common Mistakes
Using PUT instead of POST for creating new data.