In the land if Diaspora*, the news of the work being done on the API yesterday was huge. The lack of a proper API has been a thorn in the side of many people. But, it's finally happening, the API is on it's way.
Still, it's a ways off from being complete but, just posting a simple text post is currently doable, at least with cURL. Of course, it's quite a handful of commands to type but, that's easily fixed with a shell script. So, I set about on writing that script.
The following was initially posted on D*:
Ok, I think this is all working pretty well. Here is my bash script that is basically a wrapper for the steps outlined here.
You can check it out at https://code.jpope.org/jpope/podwrapper.
Be sure to look over the README.
And yes, this post was posted via the script. :D
A bash script to post to Diaspora* via the WIP API. The API will need to be enabled on the pod you are attempting to post to.
See these posts:
Save the script somewhere in your $PATH and make sure it's executable.
You will first need to register the script as a client, to do so, run
and answer the few questions that pop up. Once this step completes, it will run the login step automatically.
If for some reason, the login failed during registering, you can run the login step on it's own.
At the moment, posting via podwrapper will create public posts. It can post to specific aspects with a small tweak. In the future, this script will be expanded to allow choosing an aspect.
Posting a post can be done in two ways. You can use whatever editor you have set in your $EDITOR env variable (i.e
export EDITOR=nano) and run:
Or, you can pipe input to podwrapper such as:
cat thisismypost.txt | podwrapper -p
Upon a successful post, the post URL will be returned.
#diaspora #api #bash #script #posting
EDIT And v1.1 has been pushed. Now has the option to set your preferred posting to either ‘Public’ or ‘All aspects’. Also, you can specify what config file to use instead of the default one. https://code.jpope.org/jpope/podwrapper/src/v1.1