Resource Management

Beebotte resource management provides the following operations:

  • Create Resource to create new channel resources programmatically. This is usefull when resources need to be created in real-time.
  • Get Resource to get the list of resources of a given channel.
  • Delete Resource to delete existing channel resources programmatically.

Resource Management operations require authentication using the account API and Secret Keys.


Create Resource

You can create a new resource as follows:

bclient.addResource({
    channel: 'channel1',
    resource: {
        name: 'resource1',
        label:'test resource',
        description: 'some description goes here',
        vtype: 'string'
    }
}, function(err, res) {
    if(err) console.log(err);
    // On success, res is set to true
});
## This operation is not available yet!
// This operation is not available yet!
var resource = new Resource("channel1", "resource1", "string");
bclient.CreateResource(resource);

Get Resource

You can get the description of a channel resource as follows:

bclient.getResource({
    channel: 'channel1',
    resource: 'resource1'
}, function(err, res) {
    if(err) console.log(err);
    // On success, res is the JSON description of the resource
});
resource = bclient.getResource('channel1', 'resource1')
// This operation is not available yet!
var resource = bclient.GetResource("channel1", "resource1");

You can get the list of all resources of a channel in one call as follows:

bclient.getResource({
    channel: 'channel1',
    resource: '*'
}, function(err, res) {
    if(err) console.log(err);
    // On success, res is an Array of JSON descriptions of the resources
});
resources = bclient.getResource('channel1')
// This operation is not available yet!
var resources = bclient.GetAllResources("channel1");

Delete Resource

You can delete an existing channel resource as follows:

bclient.deleteResource({
    channel: 'channel1',
    resource: 'resource1'
}, function(err, res) {
    if(err) console.log(err);
    // On success, res is set to true
});
bclient.deleteResource('channel1', 'resource1')
// This operation is not available yet!
bclient.DeleteiResource("channel1", "resource1");