I needed some tools for talking to the Known API from the command line in order to play around with a few ideas I’ve been having.
So, I put together a few BASH shell scripts.
Installation
- Install the prerequisites:
curl php_cli python openssl base64
- Check out the repository and add it to your system path.
Note, due to this bug, you’ll need to be running the latest version of Known if you want to use the syndication functionality.
Talking to Known
The first thing you’ll need (other than a Known account of course) is to get your API key, you can find this in your settings page under “Tools and Apps”.
You can then use those as parameters to known.sh
. For example, to make a status update you’d type:
echo "body=my+data" | known.sh https://mysite.com/status/edit *username* *apikey*
Of course, you might want to use one of the wrapper scripts like status.sh
, which also supports syndication e.g:
echo "my tweet" | status.sh https://mysite.com *username* *apikey* twitter::username
If successful, the scripts will output a JSON representation of what the API says.
Have fun!