Generally, we used two APIs for IoT communication APIs are:
1. Rest based communication APIs
Representational state transfer (REST) is a set of architectural principles by which you can design web services and Web APIs that focus on system's resources and how resource states are addressed and transferred.
REST APIs follow the request response communication model.
REST architectural constraints apply to components, connectors, and data elements within a distributed hypermedia system.

REST- based communication APIs constraints
Client-server : The principal behind the client-server constraint is the separation of concerns. For example client should not be concerned with the storage of data which is concerned of the serve. Similarly, the server should not be concerned about the user interface, which is not concern of the client. The 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.
Cacheable: Cache constraints requires that the data within a response to a request be implicitly or explicitly levelled as cache-able or non-cacheable. If a response is cache-able, then a client is given the right to reuse that response data for later, equivalent requests. Caching can partially or eliminate some instructions and improve efficiency and scalability.
Layered System: layered system constraints limit the behaviour of components such that any component cannot see beyond the immediate layer to them. 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: Uniform interface constraints require that the method of communication between client and server must be uniform. Resources are identified in the requests (by URIs in web-based systems) and are 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 REST - full web service is a "Web API" implemented using HTTP and REST principles. REST is most popular IoT Communication APIs.


Join the conversation! Your thoughts help the community grow.