Deleting and Updating Data

Writing, reading and managing data is among the primary functionalities of Beebotte.

Beebotte API makes it extremely easy for an object (physical or virtual channel) to manage its data by updating or deleting it. Beebotte associates data to resources; it is possible to delete or update one record at a time.

Beebotte provides a REST API for deleting or updating data of already created resources.

Beebotte provides two types of resource data:Persistent andTransient . Persistent data will be stored into a database and will be available for future read requests. Transient data, will not be persisted. Both data message types will be routed by Beebotte and delivered to subscribers in real time. The following example shows how to delete or update persisted data. Remember that persisted data MUST be associated to an existing resource.

Delete and Update operations require specifying the message _id. The message _id is returned by read requests.


Delete resource data REST API

You can send a delete resource data API request as follows:

bclient.delete(
  {channel: 'dev', resource: 'res1', _id: 'Id_of_msg_to_delete'},
  function(err, res) {
    // Do something here
});
## cURL requires Channel Token authentication

curl -H "Content-Type: application/json" \
  -H "X-Auth-Token: YOUR_CHANNEL_TOKEN" \
  -X DELETE \
  http://api.beebotte.com/v1/data/delete/dev/res1?_id=some_msg_id

Update resource data REST API

You can send an update resource data API request as follows:

bclient.update(
  {channel: 'dev', resource: 'res1', _id: 'Id_of_msg_to_delete', data: 'new data'},
  function(err, res) {
    // Do something here
});
## cURL requires Channel Token authentication

curl -H "Content-Type: application/json" \
  -H "X-Auth-Token: YOUR_CHANNEL_TOKEN" \
  -X POST -d '{"_id": "some_msg_id", "data":"new data"}' \
  http://api.beebotte.com/v1/data/delete/dev/res1