Internet of Things
IOT Communication API’s
Name : Rohit Das
Roll :28602820008
Sem: 7th Year : 4th
IOT Communication API’s
What is an API:
An API is an interface used by programs to access an application.
It enables a program to send commands to another program and receive
replies from the app.
IoT APIs are the interface points between an IoT device and the Internet
and/or other network components
Mainly two types of communication APIs are used in IoT.
• REST based communication API
• WebSocket based communication API
1. REST Based Communication API :
REpresentational State Transfer (REST) is a set of architectural
principles by which you can design web services and web APIs
that focus on a system’s resources and how resource states are
addressed and transferred. REST APIs follow the request-
response communication model. The REST architectural
constraints apply to the components, connectors, and data
elements, within a distributed hypermedia system.
This communication API follows various constraints such as
✓ Client-server
✓ Stateless
✓ Cache-able
✓ Layered System
✓ Uniform interface
✓ Code on demand
✓ Scalability
2. Web Socket based Communication APIs :
Web Socket APIs allow bi-directional, full-duplex
communication between clients and servers. It
follows the exclusive pair communication model. This
Communication API does not require a new
connection to be set up for each message to be sent
between clients and servers. Once the connection is
set up the messages can be sent and received
continuously without any interruption. WebSocket
APIs are suitable for IoT Applications with low latency
or high throughput requirements.
Difference between REST and Websocket:
REST based communication API WebSocket based communication API
1. It supports Request-response 1. It supports Exclusive-pair communication
communication model model
2. It supports stateless protocol. 2. It supports stateful protocol.
3. It supports unidirectional communication 3. It supports bidirectional communication
between client and server as only client can between client and server i.e client and
send request to server and server only server both can request to each other.
respond to the request.
4. It is half duplex. 4. It is full duplex.
5. It uses multiple TCP connection for each 5. It uses single TCP connection for search
search over HTTP. over HTTP
6. It supports both horizontal and vertical 6. Vertical scaling is easier than horizontal
scalability. scaling