0
0
IOT Protocolsdevops~10 mins

Webhook for IoT events 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 define the HTTP method used for the webhook.

IOT Protocols
webhook_config = {"method": "[1]", "url": "http://example.com/iot"}
Drag options to blanks, or click blank then click option'
AGET
BPUT
CPOST
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET instead of POST
Using DELETE which removes data
2fill in blank
medium

Complete the code to specify the content type header for JSON data.

IOT Protocols
headers = {"Content-Type": "[1]"}
Drag options to blanks, or click blank then click option'
Aapplication/json
Btext/plain
Capplication/xml
Dmultipart/form-data
Attempts:
3 left
💡 Hint
Common Mistakes
Using text/plain which is plain text
Using application/xml which is XML format
3fill in blank
hard

Fix the error in the webhook URL by completing the missing protocol.

IOT Protocols
webhook_url = "[1]://iot.example.com/events"
Drag options to blanks, or click blank then click option'
Asmtp
Bhttp
Cftp
Dfile
Attempts:
3 left
💡 Hint
Common Mistakes
Using ftp which is for file transfer
Using smtp which is for email
4fill in blank
hard

Fill both blanks to create a dictionary comprehension filtering IoT events with temperature above 25.

IOT Protocols
filtered_events = {device: data[1] for device, data in events.items() if data['temperature'] [2] 25}
Drag options to blanks, or click blank then click option'
A.copy()
B>
C<
D.items()
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of >
Using .items() which returns key-value pairs
5fill in blank
hard

Fill all three blanks to build a JSON payload with device ID, event type, and timestamp.

IOT Protocols
payload = {"device_id": [1], "event": [2], "timestamp": [3]
Drag options to blanks, or click blank then click option'
A"sensor_01"
B"temperature_reading"
Cint(time.time())
D"humidity_reading"
Attempts:
3 left
💡 Hint
Common Mistakes
Using humidity_reading instead of temperature_reading
Not converting time to int