You can shorten addresses from your site or program with a simple API. Responses are in JSON.
Authentication
Use a user of this service and a WordPress application password (Profile → Application passwords), with HTTP “Basic” authentication. The password can be revoked at any time.
Shorten an address
curl -X POST https://andiamo.li/wp-json/andiamo/v1/links \
-u "UTENTE:PASSWORD-APPLICAZIONE" \
-H "Content-Type: application/json" \
-d '{"url":"https://esempio.it/un-articolo-molto-lungo"}'
The response (201 if the link is new, 200 if the same address had already been shortened by the same user):
{
"code": "k4m9x",
"short": "https://andiamo.li/k4m9x",
"display": "andiamo.li/k4m9x",
"url": "https://esempio.it/un-articolo-molto-lungo",
"clicks": 0,
"existing": false
}
Optional: “alias” chooses the link's name (4 to 40 characters: lowercase letters, digits and hyphens).
Other requests
GET https://andiamo.li/wp-json/andiamo/v1/ping— checks that the login worksGET https://andiamo.li/wp-json/andiamo/v1/links— your links (with page and per_page)GET|DELETE https://andiamo.li/wp-json/andiamo/v1/links/{codice}— details or deletion of a link
Each user can create a limited number of links per hour; beyond the limit the response is 429. Errors come with an HTTP code (400, 401, 409, 429) and a message.