Overview of the nRF Cloud APIs¶
This section introduces the nRF Cloud REST, MQTT, and CoAP APIs.
The following diagram shows the general relationships between the APIs, services, devices, and other components:
nRF Cloud REST API¶
The nRF Cloud REST API is organized into the following categories:
- General endpoints related to account management, certificates, and tokens and keys.
- Device management endpoints for IP, gateway, and Bluetooth® Low Energy (LE) devices:
- Endpoints related to updating firmware:
- Creating, uploading, and managing bundles.
- Initiating and managing update jobs.
- Monitoring firmware update executions.
- Location Services endpoints:
- GPS assistance data.
- Querying cell, ground fix and Wi-Fi location.
- Viewing location history.
- Endpoints to monitor bulk operation requests, such as bulk provisioning.
- Endpoints related to managing and reporting IMEIs.
- Endpoints related to device identity.
- Endpoints related to the Provisioning Service.
Authentication¶
Authentication for REST depends on the operation and which components are communicating:
- User-to-device or user-to-nRF Cloud operations require an API key. These are mostly related to provisioning, fetching device data, and viewing account or usage information.
- Device-to-cloud (D2C) endpoints are authenticated using JSON Web Tokens (JWTs). Since these operations originate from devices, nRF Cloud requires a high level of security.
- Cloud-to-cloud (C2C) use cases, such as some integrations of Location Services through a proxy server, are authenticated with JWTs.
Access
C2C use of nRF Cloud requires a Pro or Enterprise plan.
See REST API authentication for more detail on authentication concepts, and generating tokens and keys for a guide.
nRF Cloud MQTT API¶
Using the nRF Cloud MQTT API depends on which topics a device is allowed to use based on its IoT security policy. The MQTT API supports D2C use cases and some user-to-cloud operations, such as publishing messages directly on MQTT topics to which your devices are subscribed.
You can implement this in more than one way, as in the following examples:
- Use an MQTT client, such as a NodeJS app using an nRF Cloud account device to monitor and interact with all of that user's devices.
- Use secure MQTT communication over WebSockets with the nRF Cloud portal or phone gateway application.
See the MQTT API overview for more on authenticating MQTT operations, as well as documentation of all available nRF Cloud MQTT topics.
nRF Cloud CoAP API¶
The nRF Cloud CoAP API provides an additional protocol option for devices that need to optimize network traffic and power consumption. It is compatible with the following nRF Cloud components and services:
- Location Services
- FOTA
- Messaging
- Device shadow management
See the CoAP overview for more information.
Choosing a protocol¶
See Choosing a protocol for a comparison of nRF Cloud APIs, including example use cases.