How to: creating content via
Socialhome has an API which covers most of the use cases for building a client. There is also a Python library/cli client that allows creating content over the API. This is a short introductory on how to use that.
shcli requires Python 3.4+. The client has only been tested on Linux, though it should work on Windows and Mac too. The only real dependency it has is the
Create a Python environment
shcli in a virtualenv or globally, depending on your use case. For desktop users, a global installation makes sense.
Install virtualenv for your system and create a Python 3 virtualenv and activate it.
Ensure you have a compatible Python 3 version of
pip installed. For example on Ubuntu, this would be the
pip install shcli
Globally (for example on Ubuntu):
sudo pip3 install shcli
Phew, now we're past the hard part.
Get API token
Go to your Socialhome account profile and find
API token from the profile menu. Copy the token for later use. If you ever lose it, this is the place to generate a new token.
Using the tool is easy. It currently only allows creating content, so commands and options are not plenty. More will be added in the future.
The client takes a command, a domain, a token and then parameters for text and visibility. The domain is your Socialhome account domain (for example
socialhome.network) and token the API token copied in the previous step. To protect the token, the client always uses a HTTPS connection. This is why the protocol is not given in the command.
shcli create socialhome.network 1234567890abcdefg \ -t 'Hello world!' -v public
For complex creations, the client can retrieve the text from a file. Instead of
-t, pass in the file name with the
-f parameter. Visibility can be one of
That's it pretty much! The response will be either the created content as JSON or some kind of error, if something went wrong.
You can also use the API through Python by importing
shcli.create and passing in the same arguments as for the cli
The repo for
shcli is on GitHub licensed under MIT.