This Choreo writes data to and/or updates an existing feed in your Xively account. This is the primary Choreo for writing data to Feeds, Datastreams and Datapoints. For more convenient updating of metadata, please see the WriteFeedMetadata, WriteDatastreamMetadata, and WriteLocationData Choreos.
The documentation for this Xively resource can be found here.
You can easily add a single datapoint to a particular datastream using this Choreo. For that single datapoint you can specify the Timestamp, otherwise it will be recorded as the most current datapoint and given the timestamp on the server when updated. When specifying a datastream, if that datastream does not exist it will be automatically created.
For more advanced updates (such as submitting multiple datapoints for multiple datastreams), you can specify custom FeedData, which can be submitted in JSON or XML format.
The following is an example list of acceptable inputs:
APIKey: {YOUR XIVELY API KEY}
FeedID: {THE ID FOR THE FEED YOU WISH TO UPDATE}
FeedData (in JSON):
{
"version":"1.0.0",
"tags":[
"energy",
"power"
],
"datastreams" : [ {
"id" : "example",
"tags":[
"DeviceTag",
"ExampleTag2"
],
"datapoints":[
{"at":"2013-04-22T00:35:43Z","value":"41"},
{"at":"2013-04-22T00:55:43Z","value":"84"},
{"at":"2013-04-22T01:15:43Z","value":"41"},
{"at":"2013-04-22T01:35:43Z","value":"83"}
],
"current_value" : "333"
},
{
"id" : "key",
"datapoints":[
{"at":"2013-04-22T00:35:43Z","value":"revalue"},
{"at":"2013-04-22T00:55:43Z","value":"string value"},
{"at":"2013-04-22T01:15:43Z","value":"any string"},
{"at":"2013-04-22T01:35:43Z","value":"structured data"}
],
"current_value" : "value"
},
{
"id" : "datastream",
"datapoints":[
{"at":"2013-04-22T00:35:43Z","value":"51"},
{"at":"2013-04-22T00:55:43Z","value":"102"},
{"at":"2013-04-22T01:15:43Z","value":"32"},
{"at":"2013-04-22T01:35:43Z","value":"16"}
],
"current_value" : "1337"
}
]
}
If successful, the current values are stored and any changes in environment/feed metadata overwrite previous values.
For a successful feed/data update, the ResponseStatusCode should be 200.