Writing data to Rockset
POST .../v3/apps/:ref/dataconnectors
{
"type": "http",
"id": "Rockset",
"server": "api.rs2.usw2.rockset.com",
"port": 443,
"ssl": true,
"method": "post",
"path": "/v1/orgs/self/ws/commons/collections/<your-collection>/docs",
"headers": {
"Authorization": "ApiKey <your-api-key>"
},
"dataProcessingMethodId": "_mtd_819790975336057698",
"disabled": false
}
Note that Rockset expects an object like:
{
data: [
{ <your items go here> }
]
}
See Rockset API documentation for details.
toRockset()
method (id: _mtd_819790975336057698
) implementation might be something like shown below.
/**
* Method used to write changes in property values to Rockset.
*
* @param DataValue object.
*
* Sample:
* {
* "feedId": "3029106e-e704-457e-b5c3-4b09a3b9a811",
* "account": { "id": "_acc_012345678987654321", "name": "inbiza" },
* "app": { "id": "_pp_012345678987654321", "name": "SmartFactory_1" },
* "sourceTime": "2015-07-03T14:00:37.654Z",
* "serverTime": "2017-07-04T00:01:31.689Z",
* "location": {
* "zone": "sector-1"
* },
* "tags": [
* "calibrated",
* "grp:Test"
* ],
* "annotations": {
* "cusId": "FRI8-495035-4039503",
* "facility": "michigan",
* "sn": "SN-001-0023904"
* },
* "source": {
* "ip": "53.69.144.98:61785",
* "object": { "id": "_dev_924329922537879076", "name": "Compressor.1" },
* "protocol": "rest",
* "apiKeyId": "_key_924764072656096783"
* },
* "destination": {
* "object": { "id": "_dev_924329922537879076", "name": "Compressor.1" },
* "property": { "id": "_prp_924329914680031017", "name": "PressureH" },
* "state": { "PressureH": 34.5, "Temperature": 45.6, "Vibration": 3 }
* },
* "value": 23.45
* }
*
*/
return {
data: [ {
feedid: value.feedId,
// other fields go here
} ]
};
Updated over 4 years ago