Understanding the tasks performed by each HTTP method

Let's consider that http://localhost:8888/hexacopters/1 is the URL that identifies the hexacopter for our drone.

We have to compose and send an HTTP request with the following HTTP verb (PATCH) and request URL (http://localhost:8888/hexacopters/1) to set the hexacopter's motor speed in RPMs and its status. In addition, we have to provide the JSON key-value pairs with the necessary field name and the value to specify the desired speed. As a result of the request, the server will validate the provided values for the field, make sure that it is a valid speed and make the necessary calls to adjust the speed with an asynchronous execution. After the speed for the hexacopter is set, the server will return a 200 OK status code and a JSON body with the recently updated hexacopter values serialized to JSON:

PATCH http://localhost:8888/hexacopters/1 

We have to compose and send an HTTP request with the following HTTP verb (GET) and request URL (http://localhost:8888/hexacopter/1) to retrieve the current values for the hexacopter. The server will make the necessary calls to retrieve the status and the speed for the hexacopter with an asynchronous execution. As a result of the request, the server will return a 200 OK status code and a JSON body with the serialized key-value pairs that specify the status and speed for the hexacopter. If a number different than 1 is specified, the server will return just a 404 Not Found status:

GET http://localhost:8888/hexacopters/1 

We have to compose and send an HTTP request with the following HTTP verb (PATCH) and request URL (http://localhost:8888/led/{id}) to set the brightness level for a specific LED whose id matches the specified numeric value in the place where {id} is written. For example, if we use the request URL http://localhost:8888/led/1, the server will set the brightness level for the led whose id matches 1. In addition, we have to provide the JSON key-value pairs with the necessary field name and the value to specify the desired brightness level. As a result of the request, the server will validate the provided values for the field, make sure that it is a valid brightness level and make the necessary calls to adjust the brightness level with an asynchronous execution. After the brightness level for the LED is set, the server will return a 200 OK status code and a JSON body with the recently updated LED values serialized to JSON:

PATCH http://localhost:8888/led/{id} 

We have to compose and send an HTTP request with the following HTTP verb (GET) and request URL (http://localhost:8888/led/{id}) to retrieve the current values for the LED whose id matches the specified numeric value in the place where {id} is written. For example, if we use the request URL http://localhost:8888/led/1, the server will retrieve the LED whose id matches 1. The server will make the necessary calls to retrieve the values for the LED with an asynchronous execution. As a result of the request, the server will return a 200 OK status code and a JSON body with the serialized key-value pairs that specify the values for the LED. If no LED matches the specified id, the server will return just a 404 Not Found status:

GET http://localhost:8888/led/{id} 

We have to compose and send an HTTP request with the following HTTP verb (GET) and request URL (http://localhost:8888/altimeter/1) to retrieve the current values for the altimeter. The server will make the necessary calls to retrieve the values for the altimeter with an asynchronous execution. As a result of the request, the server will return a 200 OK status code and a JSON body with the serialized key-value pairs that specify the values for the altimeter. If a number different than 1 is specified, the server will return just a 404 Not Found status:

GET http://localhost:8888/altimeter/1 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.173.53