can I post on yarn through curl?
@stigatle@twtxt.net Yes 😆
@prologic@twtxt.net do you have an example somewhere? want to tinker a bit and use libcurl for it
@stigatle@twtxt.net I’ll write one up 👌
To securely login and authenticate to the API and set YARND_TOKEN
env var for later use:
IFS= read -rsp 'Password: ' password; payload="$(jq -cnr --arg password "$password" '{username: "admin", "password": $password}')"; export YARND_TOKEN="$(curl -s -d "$payload" http://localhost:8000/api/v1/auth | jq -r '.token')"
To verify that you are logged in and authenticated:
curl -s -d '' -H "Token: $YARND_TOKEN" http://localhost:8000/api/v1/whoami
To verify the API endpoint(s) are working (no authentication required):
curl -s http://localhost:8000/api/v1/ping
And finally to make a post:
curl -s -d '{"text": "Hello World!"}' -H "Token: $YARND_TOKEN" http://localhost:8000/api/v1/post | jq '.'
@prologic@twtxt.net thank you so much!
perfect for what I needed.
@stigatle@twtxt.net No worries 👌