.. _Concepts: #################### Concepts #################### ALIOT GW Cloud API ****************** The ALIOT Gateway Cloud API allows third-party software to interact with applications (called modules) hosted on one or more gateways. The API has two parts: * A **REST API**: allows third-party software applications to interact with GW applications. * A **Webhook API**: allows third-party software applications to receive notifications from GW applications. The API offers several different API contracts that are grouped in this documentation as follows: * **General contracts**: API contracts that are not module-specific. - :ref:`Ping contract ` - :ref:`Asset contract ` - :ref:`Module contract (module independent) ` * **Module-specific contracts**: contracts that are specific to a module. - REST API module contracts: API contracts enabled by the RestApiModule running on the gateway, allowing interaction with local devices linked to the gateway. Go to :ref:`supported devices ` to learn more about the supported devices and their REST API module contracts. .. _Concepts_AuthorizationLevels: Authorization Levels ==================== For a third-party software application to use the API contracts, a set of permissions called authorization levels must be defined. These permissions determine the scope of actions that a third-party application can perform through either the REST API or the Webhook API. These permissions can be divided into three types: * allow data retrieval * allow data writing or executing an action * allow sending a webhook notification The required authorization level (permission) for a specific API call or notification is documented in the API contracts mentioned above. .. _Concepts_Credits: API Credits =========== REST and Webhook API usage for a third-party software application is monitored. The aggregated usage of both APIs is validated against the available credits granted by the linked subscription. If usage exceeds the available credits, API calls will no longer be possible and webhook messages will no longer be sent. .. attention:: As the GW Cloud API is still under development, the credits functionality is not yet implemented. .. _Concepts_ALIOT: ALIOT ***** ALIOT is Alphatronics' IoT platform for managing its IoT gateways. The GW Cloud API facilitates communication between a third-party application and these gateways over the internet. In the context of ALIOT and the GW Cloud API, an Alphatronics gateway is called an **Asset**. Assets can communicate with several local devices and can run multiple applications called **modules**. Each module can offer an API contract (a set of API calls and event messages) through the GW Cloud API. Assets are protected against unauthorized access through a hierarchical structure based on **Tenants, End customers, and Sites**. The paragraphs below provide more background information about these terms. Claiming ======== To manage an asset (for monitoring, updates, and user or API access) through ALIOT, it must first be claimed by a **tenant**, which represents the company that **manages** the asset. Assigning ========= Besides being claimed by a tenant, an asset must also be assigned to a **site**. A site represents the physical location of an asset. The site is linked to an **end customer**, which represents the company that **owns** the asset. Integrating =========== A tenant owner (a user with full access to a tenant) can create a **GW Cloud API integration project** and link it to one or more end customers within that tenant. This integration project represents the third-party application that interacts with one or more gateways (assets). The third-party application will have access to all gateways linked to the sites of the end customers associated with the integration project. The image below gives an overview of the concepts described above: .. image:: /content/Images/DomainConcepts.png :width: 60%