Realtime Cloud Storage

deleteItem

Deletes a specified item or the selected attributes matching the key in a table.

Sample

curl 'https://storage-backend-prd-useast1.realtime.co/deleteItem' -H 'Content-Type: application/json; charset=UTF-8' -d '{ "applicationKey": "[YOUR_APP_KEY]", "authenticationToken": "[YOUR_TOKEN]", "table": "SampleUser", "key": { "primary": "developer", "secondary":1 } }'

Parameters

String applicationKey

Public key of the application's license.

String privateKey optional

Private key of the application's license. For administration use only.

String authenticationToken

Identification of the user using the application.

String table

The name of the table.

DataKey key

Identification of the item.

String[] properties optional

The names of the attributes. If not present it will delete all the attributes that belong to the item with the given store key.

DeleteItemResponse callback

Function called when the operation completes.

Response

DeleteItemResponse(data, error)

Response of the deleteItem operation.

Object data

The deleted items properties.

Error error

The attribute that holds the results of the operation if an error occurred.

Notifications

A notification is a Realtime Cloud Messaging message sent each time an item is inserted, updated or deleted. To receive these messages, you must connect using cluster URL http://ortc-storage.realtime.co/server/2.1 and subscribe a channel with the following syntax:

rtcs_[TABLE]

Receive notifications of all changes made to the items of a TABLE.

rtcs_[TABLE]:[PRIMARY_KEY]

Receive notifications of changes made only for the specific item(s) with the PRIMARY_KEY stored in TABLE.

rtcs_[TABLE]:[PRIMARY_KEY]_[SECONDARY_KEY]

Receive notifications of changes made only for the specific item with the PRIMARY_KEY and SECONDARY_KEY stored in TABLE.

where [TABLE] should be replaced with the name of the table; [PRIMARY_KEY] with the value of a primary key and [SECONDARY_KEY] with the value of a secondary key.

At least two, and at most three, notifications are sent each time an operation is done over an item, depending whether the table has a secondary key. All of them include the item and are sent to the above mentioned channels. The message includes the type of operation (put, update, delete) and data with the changed item.


// subscribe to a channel at table level. All changes made to items in table 'SampleUser' will be received.
connection.subscribe("rtcs_SampleUser", function(message) {
    var item = message.data;
    console.log(message.type, "of user", item.id);
});

// subscribe to a channel at primary key level. All changes made to items with primary key 'developers' will be received.
connection.subscribe("rtcs_SampleUser:developer", function(message) {
    var item = message.data;
    console.log(message.type, "of user", item.id);
});

// subscribe to a channel at secondary key level (the most restrict). All changes made to the item with primary key 'developers' and secondary key 1 will be received.
connection.subscribe("rtcs_SampleUser:developer:1", function(message) {
    var item = message.data;
    console.log(message.type, "of user", item.id);
});