API
Please also have a look at our smart-me API training site on our website.
Authentication
OAuth 2.0
smart-me supports the authorization framework OAuth 2.0. External applications can apply for access to an account without having to know the login credentials. It's highly recommended for all new designs to use the OAuth API. More Information and detailed description of the OAuth.
Basic Auth
To keep it simple, the smart-me API uses "Basic Authentication". Every call to the API must include the Authentication. HTTP Basic Authentication allows credentials (such as a username and password or an API token) to be transferred in HTTP headers. The secret is encoded using Base64.
Example:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Card Access Token
After you have created a Card Access Token (e.g for NFC Card) you can also use this Token to authenticate. For this you have to send "cardaccesstoken_" plus the Card ID as Username and the Token Key as Password.
Example: Username: cardaccesstoken_123456
Password: 155ece3459ad09d5f98aad04fcfc28ac
Authorization: Basic Y2FyZGFjY2Vzc3Rva2VuXzEyMzQ1NjoxNTVlY2UzNDU5YWQwOWQ1Zjk4YWFkMDRmY2ZjMjhhYw==
REST API Samples
A few REST API samples can you find here: REST API Samples
API Client Library for .Net
To integrate smart-me API functionality into your .Net application you can use this library. It makes HTTP requests to the smart-me REST API. All HTTP request and response bodies are mapped to .Net classes.
Realtime (Webhook) API
The smart-me Realtime (Webhooks) API allows you to subscribe to new data of a device. You can subscribe to a single device or to all devices of a user. When a device sends new data to the cloud, a webhook sends this data as a POST request to a reconfigured URL. More Information [1]
Proto File
package RealtimeApi.Containers;
import "bcl.proto"; // schema for protobuf-net's handling of core .NET types
message DeviceData {
required bcl.Guid DeviceId = 1;
required bcl.DateTime DateTime = 2;
repeated DeviceValue DeviceValues = 3;
}
message DeviceDataArray {
repeated DeviceData DeviceDataItems = 1;
}
message DeviceValue {
required bytes Obis = 1;
required double Value = 2;
}