Отримати список URL-адрес.
GET /api/v1/urls
Authorization: Bearer {token}
{
"data": [
{
"id": 1,
"hash": "S8akS",
"shortUrl": "http://lnkz.at/S8akS",
"url": "https://example.com",
"clicks": 146,
"expiresAt": "2023-07-04 10:00:00",
},
{
"id": 1,
"hash": "rnMyK",
"shortUrl": "http://lnkz.at/rnMyK",
"url": "https://google.com",
"clicks": 755,
"expiresAt": "2023-12-12 13:30:00",
}
]
}
200
Отримати інформацію про конкретну URL-адресу.
GET /api/v1/urls/{id}
Authorization: Bearer {token}
{
"data": {
"id": 1,
"hash": "S8akS",
"shortUrl": "http://lnkz.at/S8akS",
"url": "https://example.com",
"clicks": 146,
"expiresAt": "2023-07-04 10:00:00",
}
}
200
Створити нову URL-адресу.
Поле "expiresAt" є необов'язковим.
POST /api/url
Authorization: Bearer {token}
Content-Type: application/json
{
"url": "https://www.youtube.com",
"expiresAt": "2025-12-31 23:59:59"
}
{
"data": {
"id": 3,
"hash": "2zKwy",
"shortUrl": "http://lnkz.at/2zKwy",
"url": "https://www.youtube.com",
"clicks": null,
"expiresAt": "2025-12-31T23:59:59.000000Z"
}
}
201
Оновити існуючу URL-адресу.
Поле "expiresAt" може бути null.
PUT /api/v1/urls/{id}
Authorization: Bearer {token}
Content-Type: application/json
{
"url": "https://example.com",
"expiresAt": "2025-12-31 23:59:59"
}
empty
200
Видалити існуючу URL-адресу.
DELETE /api/v1/urls/{id}
Authorization: Bearer {token}
Empty
204