Complete the code to specify the HTTP method for retrieving device data.
curl -X [1] http://api.example.com/devices/123
The GET method is used to retrieve data from a server without changing it.
Complete the code to update device settings using the correct HTTP method.
curl -X [1] -d '{"mode":"eco"}' http://api.example.com/devices/123/settings
PUT is used to update or replace a resource on the server.
Fix the error in the API endpoint to correctly delete a device.
curl -X DELETE http://api.example.com/devices/[1]The endpoint must specify the device ID to delete that specific device.
Fill both blanks to create a JSON response showing device status and battery level.
{
"status": "[1]",
"battery": [2]
}The device is online and the battery level is 85 percent.
Fill all three blanks to define a RESTful API route for creating a new device with POST method.
POST [1] HTTP/1.1 Host: api.example.com Content-Type: [2] [3]
The POST request targets the '/devices' endpoint with JSON content type and a JSON body describing the new device.