chore: update API documentation
This commit is contained in:
@@ -12,7 +12,7 @@ Images available on [Docker Hub](https://hub.docker.com/r/sjdonado/bit/tags).
|
||||
It is feature-complete by design. Its strength lies in simplicity, a reliable URL shortener without unnecessary bloat. Bug fixes will continue, but new features aren't planned.
|
||||
|
||||
- Minimal tracking setup: Country, browser, os, referer. No cookies or persistent tracking mechanisms are used beyond what's available from a basic client's request.
|
||||
- Flexible request forwarding system passes client context (IP, user-agent) to destinations via standard X-Forwarded-For and X-Forwarded-User-Agent headers, enabling advanced tracking and integration capabilities when needed.
|
||||
- Flexible request forwarding system passes client context (IP, user-agent) to destinations via standard `X-Forwarded-For` and `User-Agent` headers, enabling advanced tracking and integration capabilities when needed.
|
||||
- Multiple users are supported via API key authentication. Create, list and delete via the [CLI](docs/SETUP.md#cli).
|
||||
|
||||
## Minimum Requirements
|
||||
|
||||
+40
-22
@@ -10,7 +10,6 @@
|
||||
"data": "pong"
|
||||
}
|
||||
```
|
||||
|
||||
2. **Redirect by Slug**
|
||||
|
||||
- Endpoint: `GET /:slug`
|
||||
@@ -21,7 +20,9 @@
|
||||
|
||||
- Endpoint: `GET /api/links`
|
||||
- Headers: `X-Api-Key`
|
||||
- Payload: None
|
||||
- Query Parameters:
|
||||
- `limit` (optional): Number of results per page (default: 100)
|
||||
- `cursor` (optional): Pagination cursor from previous response
|
||||
- Response Example
|
||||
```json
|
||||
{
|
||||
@@ -29,28 +30,21 @@
|
||||
{
|
||||
"id": "84f0c7a4-8c4e-4665-b676-cb9c5e40f1db",
|
||||
"refer": "http://localhost:4000/3wP4BQ",
|
||||
"origin": "https://monocuco.donado.co",
|
||||
"clicks": [
|
||||
{
|
||||
"id": "730e2202-58f9-478c-a24c-f1c561df6716",
|
||||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0",
|
||||
"country": "DE",
|
||||
"browser": "Firefox",
|
||||
"os": "Mac OS X",
|
||||
"referer": "Direct",
|
||||
"created_at": "2024-07-12T19:25:22Z"
|
||||
}
|
||||
]
|
||||
"origin": "https://monocuco.donado.co"
|
||||
}
|
||||
]
|
||||
],
|
||||
"pagination": {
|
||||
"has_more": true,
|
||||
"next": "75e0a7f4-9c5e-1235-b546-eb9c5e40f7ac"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. **List link by ID**
|
||||
|
||||
- Endpoint: `GET /api/links/:id`
|
||||
- Headers: `X-Api-Key`
|
||||
- Payload: None
|
||||
- Note: This endpoint returns up to 100 of the most recent clicks. For complete click history, use the `/api/links/:id/clicks` endpoint with pagination.
|
||||
- Response Example
|
||||
```json
|
||||
{
|
||||
@@ -73,9 +67,35 @@
|
||||
}
|
||||
```
|
||||
|
||||
5. **Create new link**
|
||||
5. **List Clicks for a Link**
|
||||
- Endpoint: `GET /api/links/:id/clicks`
|
||||
- Headers: `X-Api-Key`
|
||||
- Query Parameters:
|
||||
- `limit` (optional): Number of results per page (default: 100)
|
||||
- `cursor` (optional): Pagination cursor from previous response
|
||||
- Response Example
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "730e2202-58f9-478c-a24c-f1c561df6716",
|
||||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0",
|
||||
"country": "DE",
|
||||
"browser": "Firefox",
|
||||
"os": "Mac OS X",
|
||||
"referer": "Direct",
|
||||
"created_at": "2024-07-12T19:25:22Z"
|
||||
}
|
||||
],
|
||||
"pagination": {
|
||||
"has_more": true,
|
||||
"next": "629e3301-47f8-389b-b24c-f1c561df9825"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Endpoint\*\*: `POST /api/links`
|
||||
6. **Create new link**
|
||||
- Endpoint: `POST /api/links`
|
||||
- Payload:
|
||||
```json
|
||||
{
|
||||
@@ -95,8 +115,7 @@
|
||||
}
|
||||
```
|
||||
|
||||
6. **Update an existing link by ID**
|
||||
|
||||
7. **Update an existing link by ID**
|
||||
- Endpoint: `PUT /api/links/:id`
|
||||
- Payload:
|
||||
```json
|
||||
@@ -117,8 +136,7 @@
|
||||
}
|
||||
```
|
||||
|
||||
7. **Delete a link by ID**
|
||||
|
||||
8. **Delete a link by ID**
|
||||
- Endpoint: `DELETE /api/links/:id`
|
||||
- Payload: None
|
||||
- Headers: `X-Api-Key`
|
||||
|
||||
Reference in New Issue
Block a user