The Toit console provides a publicly available gRPC API with API packages and examples for Java, Python, Dart, C# and NodeJS, allowing a client application to do all public operations on the Toit console.
The service is available on:
The API is guarded so all requests should be authorized with
Authorization: Bearer access-token.
access-token available using the toit.api.Auth service.
Create an API key to be used when connecting server applications to the API.
Navigate to the API keys section in the Toit console and press the Create API key button.
Then, view (and copy) the API key secret.
Navigate to the API keys section in the Toit console and view the API key secret by clicking the key icon.
The API key secret must be used when creating the connection - in your server application - to the Toit Cloud. See examples of how to create the connection using the API key secret in the demo repository, where we provide examples of API usage in four different programming languages: NodeJS, Java, Go, and Python.
The Toit console provides a data ingestion API. The type of data to be ingested is grouped into two groups:
- System metrics - measurement at a point in time for the system generated by the
- Logs - system generated set of data that describe an event generated by the
For application data, please use the bi-directional PubSub API.
System metrics and logs are collected on the device by the system process from your application code and sent to the Toit cloud, where it will be grouped and available for ingestion.
Data in the Toit console is grouped into the types:
System metrics and
For each type, a Toit project can have multiple subscriptions.
A subscription is simply a cursor managed by the Toit console on which messages the subscriber has read.
Every time a message has been read it needs to be acknowledged by the subscriber in order to move the subscription cursor forward, permanently.
Each message must be acknowledged before the acknowledge deadline (10 minutes by default), otherwise it will be enqueued again.
If a subscription is more than 7 days behind, messages will be pruned and missed by the subscriber.
It is possible to do concurrent reads on one subscription. When doing so, the concurrent reads will receive different batches of the same data set, making it easier to make ingestion concurrent.
Go to the Data section in the Toit console, choose either the the
System metrics tab, click on Create Subscription, and add a name to the subscription to create.
Use the CLI commands to acknowledge messages for a subscription.