The Toit console provides a publicly available gRPC API (with API packages and examples for Java, Python and NodeJS) allowing a client application to do all public operations on the Toit console.

The service is available on: https://api.toit.io.

The API is guarded so all requests should be authorized with Authorization: Bearer <access-token>. with the access-token available using the toit.api.Auth service.

Use toit org api-keys to create a key that can be used to connect server applications to the API.

Data API

The Toit console provides a data ingestion API. The type of data to be ingested is grouped into two groups: Metrics (measurement at a point in time for the system generated by the metrics library) and Logs (system generated set of data that describe an event generated by the logs library).

The Toit API also includes App data for application data published using the data library. However, for a subscription to this kind of data we recommend using the bi-directional PubSub API instead.

Data is 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. On ingestion the data is still grouped into metrics and logs.

Data subscriptions

Data in the Toit console is always grouped into the types Metrics, Logs and App data. For each data type, an organization 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 page and click on Create Subscription. Select Logs, Metrics or App data and type in the name of the subscription.

Screenshot of Data page on the Toit console

Once you created a subscription, you can choose to visualize in two graphs at the top of the page the number of unacknowledged messages for that subscription, as well as the age of the oldest unacknowledged message for the selected time interval.

Use the CLI commands to acknowledge messages for a subscription.