This is a .NET implemenation of the API documentation.
Use class ClientFactory
to get a client instance for SmartObjects. Then, use the appropriate method to instantiate an owner, object, or event API instance for ingestion and Restitution for searching.
Use classes Owner
, SmartObject
, and Event
to build the entities. There are two ways to build these entities as seen below.
This SDK supports both synchronous and asynchronous (non-blocking) calls. As seen in examples below, for async calls, we pass the entity instance to be updated by the callback function.
Client token authentication is supported. User token authentication is not supported yet.
- SDK requires .NET 4.5.1 or higher.
- SDK has been built using nuget.
Include the mnubo client in your .NET application using Nuget (Coming Soon).
Download the source code and include it in your .NET Application project.
To get a client instance use the ClientFactory
Class.
ClientConfig config = new ClientConfig.Builder() {
Environment = Environments.Sandbox,
ConsumerKey = "theConsumerKey",
ConsumerSecret = "theConsumerSecret"
};
var client = ClientFactory.Create(config);
You can use the client.Owners
methods:
Owner owner = new Owner.Builder() {
Username = "theUsername",
Password = "thePassword"
};
client.Owners.Create(owner);
client.Owners.Delete("theUsername");
You can use the client.Objects
methods:
SmartObject smartObject = new SmartObject.Builder() {
DeviceId = "theDeviceId",
ObjectType = "theObjectType"
};
client.Objects.Create(smartObject);
client.Owners.Claim("theUserName", "theDeviceId");
You can use the client.Events
methods:
Event event1 = new Event.Builder() {
EventType = "theEventType",
DeviceId = "aDeviceId",
Timeseries = new Dictionary<string, object>() {
{"pressure", 1026.92}
}
};
Event event2 = new Event.Builder() {
EventType = "theEventType",
DeviceId = "anOtherDeviceId",
Timeseries = new Dictionary<string, object>() {
{"pressure", 1013.36}
}
};
client.Events.Post(new List<Event>() { event1, event2 });
You can use the client.Restitution
methods:
To get all Datasets associated to the Namespace:
client.Restitution.GetDataSets();
Or search to use the search API:
string query = "{\"from\":\"owner\",\"select\":[{\"value\":\"username\"},{\"value\":\"x_registration_date\"}],\"where\":{\"username\":{\"EQ\":\"USERNAME TO SEARCH\"}}}";
ResultSet result = client.Restitution.Search(query);
Please take a look in the documentation of Mnubo to get more detail about how to use the Search API.