Xively
DEAD
The free version of Xively is no more!
Xively
Xively – Public Cloud for the Internet of Things - http://xively.com
COSM
COSM has been renamed to Xively
Cosm is now Xively. Read more
Libraries
Xively library xively-python - https://github.com/xively/xively-python
Welcome to Xively Python’s documentation — Xively Python 0.1.0-rc2 documentation - http://xively.github.io/xively-python/
Xively REST API - Xively - https://xively.com/dev/docs/api/
Libraries - Xively - https://xively.com/dev/libraries/
- Android
- Arduino
- ARM® mbed
- C
- Electric Imp
- Java
- JavaScript
- Objective-C
- PHP
- Python
- Ruby
Single Datastream - PNG Graphs - Xively - https://xively.com/dev/docs/api/data/read/single_datastream/
- https://api.xively.com/v2/feeds/61916/datastreams/ random900.png?c=2188c5&g=true&t="My Graph"&b=true
Technology Projects: Live embedded Cosm graphs - http://matt-electronicsprojects.blogspot.com/2012/09/live-embedded-cosm-graphs.html
- As a minor bonus to the Cosm service, I found you can create an embeddable graph for your data to stick in any website...
- http://matt-electronicsprojects.blogspot.co.uk/p/current-weather-in-liss-uk.html
- https://api.cosm.com/v2/feeds/73642/datastreams/pressure.png?width=730&height=250&colour=%23f15a24&duration=1day&legend=hPa&title=Pressure&show_axis_labels=true&detailed_grid=true&scale=auto
Oeey Gooey Raspberry Pi: Data Logging with the Internet of Things - http://www.oeey.com/2013/09/data-logging-with-internet-of-things.html
curl
Curl - How-to use Xively API on the command-line - https://xively.com/dev/tutorials/curl/
Create feed:
curl --request POST \ --data '{"title":"My feed", "version":"1.0.0"}' \ --header "X-ApiKey: YOUR_API_KEY_HERE" \ # replace this with your key --verbose \ https://api.xively.com/v2/feeds
Update feed:
curl --request PUT \ --data-binary @feed_update_payload.json \ --header "X-ApiKey: YOUR_API_KEY_HERE" \ # replace this with your key --verbose \ NEW_FEED_URL # replace this with new feed's URL
Retrieve feed:
curl --request GET \ --header "X-ApiKey: YOUR_API_KEY_HERE" \ # replace this with your key --verbose \ NEW_FEED_URL # replace this with new feed's URL
Free Developer Account
Get a free Developer Account - https://xively.com/pricing/#developer-account
Limits:
- Unlimited Development Devices with unlimited channels
- Development devices store data for 30 days.
- Developer Account API limit 25 API calls per minute, 3 minute moving average.
Installation
# Xively Library Installation git clone https://github.com/kennethreitz/requests git clone https://github.com/xively/xively-python cd xively-python ln -s ../requests/requests # verify import throws no errors echo "import xively" | python
---
Alternative:
# also installs 'requests' pip install xively-python # verify import throws no errors echo "import xively" | python
Note: if you are getting an error message that says “Could not find a version that satisfies the requirement”, you should try running: [1]
pip install --pre xively-python.
Update Script
#!/usr/bin/python2.7 # NOTE: xively requires Python 2.7+ import sys import datetime import xively API_KEY = "API_KEY" # set to your API Key FEED_ID = "FEED_ID" # set to your Feed ID if len(sys.argv) != 3: print "Usage: {0} <channel> <value>".format(sys.path[0]) sys.exit(1) channel = sys.argv[1] value = sys.argv[2] api = xively.XivelyAPIClient(API_KEY) feed = api.feeds.get(FEED_ID) now = datetime.datetime.utcnow() feed.datastreams = [ xively.Datastream(id=channel, current_value=value, at=now) ] feed.update()
Usage:
./xively-update.py sensor1 42
Tutorials
Raspberry Pi - Xively Tutorials - https://xively.com/dev/tutorials/pi/
Xively Python’s documentation — Xively Python 0.1.0-rc2 documentation - http://xively.github.io/xively-python/