API Dokümantasyonu

Tekli ve toplu kısaltma örnekleri.

API Anahtarı

DB etkin olduğunda /api/keys ile anahtar üretebilir, Authorization: Bearer <key> başlığı ile istek yapabilirsiniz.

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_KEY" -d '{"url":"https://pushai.dev/","slug":"custom"}' http://localhost:3000/api/shorten

Tekli

curl -X POST -H "Content-Type: application/json" -d '{"url":"https://pushai.dev/","slug":"custom"}' http://localhost:3000/api/shorten

Toplu

curl -X POST -H "Content-Type: application/json" -d '{"rows":[{"url":"https://pushai.dev/","slug":"home"},{"url":"https://example.com"}]}' http://localhost:3000/api/shorten/bulk

JavaScript

const res = await fetch('/api/shorten',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({url:'https://example.com'})});
const data = await res.json();
console.log(data.shortUrl);

Örnek akış `pushai.dev` deneyimine benzer. Daha fazlası için: https://pushai.dev/