Nice and informative article. But heed this fact as well. Take your URI:

www.yourapi.com/data/savedata?name=temperature&value=32

RESTful requests are inherently resource-oriented. But this request is more like an instruction. Generally, if you’re adhering to RESTful practices, you do not specify your endpoint like the above. What you generally do is like this.

Say that you want to send name and value to your sensor. Usually, if you adhere to proper REST practices you should have an endpoint like /data and a POST request for /data endpoint should store the data sent in the request body. (Similarly, the GET request should also be handled by another /data endpoint separately, in the case of retrieving data) There are generally two methods of data serialization (If you disregard new protocols like ProtoBuf) in HTTP layer: 1) XML (Old method) 2) JSON. So what you do is you set the header Content-Type parameter of to application/json and have {name: 'temperature', value:32} in the POSTrequest body.

Software Engineer @ CodeGen International, CSE Graduate @ University of Moratuwa

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store