Documentation
API Key
xively.setKey (newKey)
As you might know, Xively requires an API Key to interface with the service. Just click Keys on your user menu to create or use an existing key and use the .setKey method to set the key before using any other methods. This will make sure that you can work your feeds as you intend.
Feeds
Every Device on Xively owns a single Feed, in which it stores its data, metadata, and waypoints. For more on creating Devices, visit https://xively.com.
xively.feed.get (feedID, callback(data))
xively.feed.update (feedID, data{}, callback(data))
data{} - Object with this JSON structure
xively.feed.delete (feedID, callback(data))
xively.feed.history (feedID, options{}, callback(data))
options{} - Object containing the parameters specified here
xively.feed.list (options{}, callback(data))
options{} - Object containing the parameters specified here
xively.feed.subscribe (feedID, callback(event, data))
xively.feed.unsubscribe (feedID)
Datastreams
In most cases, it is recommended to use the Feed-level update function to update Datastreams instead of updating them individually. This lets you affect multiple datastreams in a Feed simultaneously.
xively.datastream.get (feedID, datastreamID, callback (data))
xively.datastream.update (feedID, datastreamID, data{}, callback (data))
data{} - Object with this JSON structure
xively.datastream.new (feedID, data{}, callback (data))
data{} - Object with this JSON structure
xively.datastream.delete (feedID, datastreamID, callback (data))
xively.datastream.history (feedID, datastreamID, options{}, callback(data))
options{} - Object containing the parameters specified here
xively.datastream.list (feedID, callback(data))
xively.datastream.subscribe (feedID, datastreamID, callback(event, data))
xively.datastream.unsubscribe (feedID, datastreamID)
xively.datastream.live (CSS selector, feedID, datastreamID)
xively.datastream.stop (CSS selector)
Datapoints
xively.datapoint.get (feedID, datastreamID, timestamp, callback (data))
xively.datapoint.update (feedID, datastreamID, timestamp, value, callback (data))
xively.datapoint.new (feedID, datastreamID, data{}, callback (data))
data{} - Object with this JSON structure
xively.datapoint.delete (feedID, datastreamID, timestamp or options{}, callback (data))
If you want to delete multiple datapoints, pass an object instead of a timestamp as specified here.
xively.datapoint.history (feedID, datastreamID, options{}, callback(data))
options{} - Object containing the parameters specified here
Request
xively.request (options{}, callback (data))
- type: [string] example: "get"
- url: [string] example: "http://api.xively.com/v2/feeds/504.json"
- done: [function] Callback for successful response, receives JSON response as only argument
- fail: [function] Callback for failed response, receives JSON response as only argument
- always: [function] Callback for any response, receives JSON response as only argument
This is the underlying request gateway that most methods use, it essentially makes sure everything is sent properly.
Socket Server (Beta)
xively.subscribe (resource, callback(event, data))
xively.unsubscribe (resource)
xively.live (CSS selector, resource)
xively.stop (CSS selector)
Subscribe to the socket server via WebSockets. Info on the resource argument is here.
jQuery Plugin
$(selector).xively (method, options)
- get
- live
- feed: [string] Feed ID
- datastream: [string] Datastream ID