cURL#
Command Line Options#
Specify a username and password for basic auth#
curl --user 'username:somesecurepassword' https://mysite
Specify a UserAgent to send#
curl --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0" https://mysite
Include JSON with shell variables#
generate_json_data()
{
cat <<EOF
{
"state": "NORMAL",
"content": "${content} #${cat}",
"visibility": "PRIVATE"
}
EOF
}
curl -X POST -H "Authorization: Bearer ${APIToken}" -H "Content-Type: application/json" -d "$(generate_json_data)" http://example.com/api/input