All requests require username and a password header. These should match some of the credentials in the configuration file. You also need a Content-Type header set to application/json
For an error response, the server will return a JSON with a single key- error, which has a short message describing the error. On a 2xx error code, the key is instead message.
To get the existing links, make a GET request to /simpleshortener/api/list. This returns a JSON file with the links field having a key:value list of shortening:destination.
You can add new links by making a PUT request to /simpleshortener/api/add with the JSON data
{
"link": "shorturl",
"destination": "https://example.com"
}
You can delete links by making a DELETE request to /simpleshortener/api/delete/<short url>
You can edit existing links by making a PATCH request to /simpleshortener/api/edit/<short url> with the JSON data
{
"destination": "https://example.org"
}
You can generate a QR code by making a POST request to /simpleshortener/api/qr with the JSON data
{
"destination": "https://example.net"
}