-
-
Save whee/2ec052638855b3a3d6c3 to your computer and use it in GitHub Desktop.
Twine to cosm shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pounce_json=/place/to/store/json/for/a/twine | |
grace_json=/place/to/store/json/for/another/twine | |
curl -s -b 'user_id=[your twinedotsupermechanical cookie]' -k 'https://twine.supermechanical.com/rt/[your twine id]?cached=1' > ${pounce_json} | |
curl -s -b 'user_id=[your twinedotsupermechanical cookie]' -k 'https://twine.supermechanical.com/rt/[your other twine id]?cached=1' > ${grace_json} | |
pounce_temp=$(jshon -e values -e 1 -e 1 < ${pounce_json}) | |
grace_temp=$(jshon -e values -e 1 -e 1 < ${grace_json}) | |
curl --request PUT \ | |
--data "{\"version\":\"1.0.0\",\"datastreams\":[{\"id\":\"grace_temperature\", \"current_value\":${grace_temp}}, {\"id\":\"pounce_temperature\", \"current_value\":${pounce_temp}}]}" \ | |
--header "X-ApiKey: [your cosm api key]" \ | |
http://api.cosm.com/v2/feeds/[your cosm feed number] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment