API (Application Programming Interface) is a set of rules, methods, and functions that enable different software applications to communicate with each other. An API defines how applications can request and receive data, as well as perform specific actions. It includes:
-
Operations to be performed (methods): This refers to the set of actions or tasks that an application can carry out through the API.
-
Input data (requests): This is the information that an application sends to the API to initiate a specific operation. It could be in the form of parameters, arguments, or data structures.
-
Output data (responses): This is the information that the API sends back to the application in response to a request. This could be the requested data, a status indicating whether the operation was successful, or error messages if something went wrong.
The VSaaS product API is built on REST.
The VMS API product adheres to the following REST principles:
-
Authentication: requires authentication to access resources.
-
JSON: returns data in a standard JSON format.
-
Standard HTTP codes: applies standard HTTP response codes to indicate the request status.
To ensure proper API interaction and receive responses in the expected format, all API requests must include the Content-Type: application/json header.
This header is crucial for the server (backend) to understand if the client supports JSON-formatted responses. It ensures that the server will return all data, including error messages, in JSON format.
Failure to include this header may cause the server to return responses in an unintended format (e.g., HTML), even for errors, because it lacks a clear indication of your preferred data type.