IoT Communication APIs
Generally we used Two APIs For IoT Communication. These IoT Communication APIs are:
- REST-based Communication APIs
- WebSocket-based Communication APIs
IoT Communication APIs
REST-based Communication APIs
Representational state transfer (REST) is a set of architectural principles by which you can design Web services the Web APIs that focus on systems’s resources and how resource states are addressed and transferred. REST APIs that follow the request response communication model, the rest architectural constraint apply to the components, connector and data elements, within a distributed hypermedia system. The rest architectural constraint are as follows:
Client-server – The principle behind the client-server constraint is the separation of concerns. for example clients should not be concerned with the storage of data which is concern of the serve. Similarly the server should not be concerned about the user interface, which is concern of the clien. Separation allows client and server to be independently developed and updated.
Stateless – Each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server. The session state is kept entirely on the client.
Cache-able – Cache constraints requires that the data within a response to a request be implicitly or explicitly leveled as cache-able or non cache-able. If a response is cache-able, then a client cache is given the right to reuse that repsonse data for later, equivalent requests. caching can partially or completely eliminate some instructions and improve efficiency and scalability.
Layered system – layered system constraints, constrains the behavior of components such that each component cannot see beyond the immediate layer with they are interacting. For example, the client cannot tell whether it is connected directly to the end server or two an intermediaryalong the way. System scalability can be improved by allowing intermediaries to respond to requests instead of the end server, without the client having to do anything different.
Uniform interface – uniform interface constraints requires that the method of communication between client and server must be uniform. Resources are identified in the requests (by URIsin web based systems) and are themselves is separate from the representations of the resources data returned to the client. When a client holds a representation of resources it has all the information required to update or delete the resource you (provided the client has required permissions). Each message includes enough information to describe how to process the message.
Code on demand – Servers can provide executable code or scripts for clients to execute in their context. this constraint is the only one that is optional.
A RESTful web service is a ” Web API ” implemented using HTTP and REST principles. REST is most popular IoT Communication APIs.
|Uniform Resource Identifier (URI)||GET||PUT||PATCH||POST||DELETE|
|Collection, such as
||List the URIs and perhaps other details of the collection’s members.||Replace the entire collection with another collection.||Not generally used||Create a new entry in the collection. The new entry’s URI is assigned automatically and is usually returned by the operation.||Delete the entire collection.|
|Element, such as
||Retrieve a representation of the addressed member of the collection, expressed in an appropriate Internet media type.||Replace the addressed member of the collection, or if it does not exist, create it.||Update the addressed member of the collection.||Not generally used. Treat the addressed member as a collection in its own right and create a new entry within it.||Delete the addressed member of the collection.|
WebSocket based communication API
Websocket APIs allow bi-directional, full duplex communication between clients and servers. Websocket APIs follow the exclusive pair communication model. Unlike request-response model such as REST, the WebSocket APIs allow full duplex communication and do not require new coonection to be setup for each message to be sent. Websocket communication begins with a connection setup request sent by the client to the server. The request (called websocket handshake) is sent over HTTP and the server interprets it is an upgrade request. If the server supports websocket protocol, the server responds to the websocket handshake response. After the connection setup client and server can send data/mesages to each other in full duplex mode. Websocket API reduce the network traffic and letency as there is no overhead for connection setup and termination requests for each message. Websocket suitable for IoT applications that have low latency or high throughput requirements. So Web socket is most suitable IoT Communication APIs for IoT System.
You may like also:
- How To Create Secure MQTT Broker
- How To Enable Free HTTPS on your website
- How To Install Node.js on Ubuntu
- How to install MongoDB in ubuntu
- How to Install InfluxDB on Ubuntu
- What is Jinja
8 thoughts on “IoT Communication APIs”
Pingback: Introduction of Socket.IO - A real-time web applications - IoTbyHVM
Pingback: Industry 4.0 — the Industrial Internet of Things (IIoT)?
Pingback: Slax OS - Your pocket operating system - IoTbyHVM - Explore tech bytes
Pingback: Termux- A Linux environment android app - IoTbyHVM - Explore TechBytes
Pingback: Industrial IoT | Industry 4.0 | IIoT | Industrial Internet of Things
Pingback: Nano RK : A Wireless Sensor Networking Real-Time Operating System
Pingback: What is IoT ? | Internet of Things - IoTbyHVM - Bits & Bytes of IoT
Pingback: Industrial IoT | Industry 4.0 | IIoT | Industrial Internet of Things - CompileIoT