2.9 KiB
2.9 KiB
API Reference
-
Ping the API
- Endpoint:
GET /api/ping - Payload: None
- Response Example
{ "message": "pong" }
- Endpoint:
-
Redirect by Slug
- Endpoint:
GET /:slug - Payload: None
- Response 301
- Endpoint:
-
List All Links
- Endpoint:
GET /api/links - Headers:
X-Api-Key - Payload: None
- Response Example
{ "data": [ { "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", "language": "en-US", "browser": "Firefox", "os": "Mac OS X", "source": "Unknown", "created_at": "2024-07-12T19:25:22Z" } ] } ] }
- Endpoint:
-
List link by ID
- Endpoint:
GET /api/links/:id - Headers:
X-Api-Key - Payload: None
- Response Example
{ "data": { "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", "language": "en-US", "browser": "Firefox", "os": "Mac OS X", "source": "Unknown", "created_at": "2024-07-12T19:25:22Z" } ] } }
- Endpoint:
-
Create new link
- Endpoint**:
POST /api/links - Payload:
{ "url": "https://example.com" } - Headers:
X-Api-Key - Response Example:
{ "data": { "id": "84f0c7a4-8c4e-4665-b676-cb9c5e40f1db", "refer": "http://localhost:4000/3wP4BQ", "origin": "https://monocuco.donado.co/test", "clicks": [] } }
- Endpoint**:
-
Update an existing link by ID
- Endpoint:
PUT /api/links/:id - Payload:
{ "url": "https://newexample.com" } - Headers:
X-Api-Key - Response Example:
{ "data": { "id": "84f0c7a4-8c4e-4665-b676-cb9c5e40f1db", "refer": "http://localhost:4000/3wP4BQ", "origin": "https://newexample.com", "clicks": [] } }
- Endpoint:
-
Delete a link by ID
- Endpoint:
DELETE /api/links/:id - Payload: None
- Headers:
X-Api-Key - Response Example:
{ "message": "Link deleted" }
- Endpoint: