0
0
IOT Protocolsdevops~20 mins

RESTful API design for devices in IOT Protocols - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RESTful API Device Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding RESTful API resource naming for devices

Which of the following URL paths best follows RESTful API design principles for accessing a list of all devices?

A/devices
B/getDevices
C/deviceList
D/listDevices
Attempts:
2 left
💡 Hint

Think about using nouns and plural forms for resource collections.

💻 Command Output
intermediate
2:00remaining
HTTP method for updating device configuration

What is the expected HTTP status code when successfully updating a device configuration using a PUT request?

IOT Protocols
PUT /devices/123/config HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"mode": "active", "threshold": 75}
A201 Created
B200 OK
C204 No Content
D404 Not Found
Attempts:
2 left
💡 Hint

Consider what status code means successful update with response body.

🔀 Workflow
advanced
3:00remaining
Correct sequence of RESTful API calls to register and activate a device

Arrange the following API calls in the correct order to register a new device and then activate it.

A1,2,4,3
B2,1,3,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint

Think about creating first, then checking, then updating status.

Troubleshoot
advanced
2:00remaining
Diagnosing a 405 Method Not Allowed error on device endpoint

A client sends a DELETE request to /devices/456 but receives a 405 Method Not Allowed error. What is the most likely cause?

AThe client sent an invalid JSON payload
BThe server is down
CThe API does not support DELETE method on /devices/{id}
DThe device ID 456 does not exist
Attempts:
2 left
💡 Hint

405 means the method is not allowed on the resource.

Best Practice
expert
3:00remaining
Choosing the best approach for device API versioning

Which of the following is the best RESTful API versioning strategy for devices to ensure backward compatibility?

AInclude version number in the URL path, e.g., /v1/devices
BAdd version as a query parameter, e.g., /devices?version=1
CUse a custom HTTP header for version, e.g., X-API-Version: 1
DChange the resource names for each version, e.g., /devicesV1
Attempts:
2 left
💡 Hint

Consider clarity and cacheability in URLs.