Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

IoT Communication API

YASH PAL, 9 May 202228 May 2024

IoT Communication API is the point of interaction between an IoT device and the internet and/or other elements within the network. Representational State Transfer (REST) is a set of architectural principles where we can design Web services the Web APIS that focus on the system’s resource and how resource states are addressed and transferred.

IoT Communication API

REST APIS follows the request-response, communication model. REST architectural constraints apply to the components, connectors, and data elements, within a distributed hypermedia system. A RESTful web service is a ” Web API ” implemented using HTTP and REST principles. REST is the most popular lol Communication APIS. The rest architectural constraint is as follows:

Client-server

The function of the client-server constraint is the separation of concerns, for example, clients should not be concerned with the storage of data which is a concern of the server. furthermore, the server should not be concerned about the user interface which is a concern of the client. Separation allows the client and server to be independently developed and updated.

Stateless

When a request is sent from a client to the server. It must contain all the necessary information 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

The principle behind the cachable constraint is 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 cacheable, then a client cache is given the right to reuse that response data for later, the same as the request. Caching can partially or completely eliminate some instructions and improve efficiency and scalability.

Layered System

The work of layered system constraint is to necessitate the behavior of components in that each component cannot see beyond the immediate layer with which they are interacting. For example, the client cannot tell whether it is connected directly to the end server or two an intermediary along 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

The main aim of the uniform interface constraint is that the communication between the client and server must be uniform. Resources are identified in the requests and are themselves separate from the representations of the resource 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. Each message includes sufficient information to explain how to process the message.

Code on Demand

This constraint is the only one that is optional. Servers can provide executable code for clients to execute in their context.

Web Socket-Based Communication API

Web Socket APIS is a full-duplex communication between clients and servers. It allows bi-directional communication and Web Socket APIS pursues the exclusive pair communication model. Unlike request-response models such as REST, web sockets do not require a new connection to be set up for each message to be sent.

Web Socket communication starts with a connection setup request sent by the client to the server. The request is sent over HTTP and the server interprets it as an upgrade request. If the server supports web socket protocol, the server responds to the Web Socket handshake response. After the connection setup, the client and server can send data/messages to each other in full-duplex mode.

Weh socket API reduces the network traffic and latency as there is no overhead for connection setup and termination requests for each message. Web sockets are suitable for IoT applications that have low latency or high throughput requirements.

Other IoT Tutorials

  • IoT Enabling Technologies
  • Embedded System in IoT
Computer Science Tutorials Internet of Things Tutorials computer scienceIOT

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
How to download udemy paid courses for free

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
©2025 Programming101 | WordPress Theme by SuperbThemes