Integrasikan Shortku ke aplikasi Anda
https://s.zetri.my.id
Mengubah URL panjang menjadi short URL.
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
url | string | ✅ | URL panjang yang ingin diperpendek |
curl -X POST https://s.zetri.my.id/api/shorten
-H "Content-Type: application/json"
-d '{"url":"https://example.com/sangat/panjang"}'
{
"shortUrl": "https://s.zetri.my.id/abc123",
"code": "abc123",
"originalUrl": "https://example.com/sangat/panjang"
}
| Status | Kondisi |
|---|---|
400 | URL tidak disertakan |
400 | Format URL tidak valid |
400 | URL terlalu panjang (>2048 karakter) |
500 | Internal server error |
Akses short URL — otomatis redirect ke URL asli.
# Buka di browser:
https://s.zetri.my.id/abc123
# Akan 301 redirect ke:
# https://example.com/sangat/panjang
Lihat jumlah klik dan metadata short URL.
{
"code": "abc123",
"original_url": "https://example.com/sangat/panjang",
"clicks": 42,
"created_at": "2026-06-16 04:15:12",
"updated_at": "2026-06-16 04:20:30"
}
{ "error": "Code not found" }
import requests
# Shorten
resp = requests.post("https://s.zetri.my.id/api/shorten", json={
"url": "https://example.com/link-panjang"
})
data = resp.json()
print("Short URL:", data["shortUrl"])
print("Code:", data["code"])
# Stats
stats = requests.get(
f"https://s.zetri.my.id/api/stats/{data['code']}"
).json()
print("Clicks:", stats["clicks"])
// Shorten URL
async function shorten(url) {
const res = await fetch("https://s.zetri.my.id/api/shorten", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url })
});
const data = await res.json();
return data;
}
// Pakai
shorten("https://example.com").then(d => {
console.log("Short URL:", d.shortUrl);
});
import axios from "axios";
// Shorten
const { data } = await axios.post(
"https://s.zetri.my.id/api/shorten",
{ url: "https://example.com" }
);
console.log(data.shortUrl);
// Stats
const { data: stats } = await axios.get(
`https://s.zetri.my.id/api/stats/${data.code}`
);
console.log(`${stats.clicks} clicks`);
$ch = curl_init("https://s.zetri.my.id/api/shorten");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://example.com"
]),
CURLOPT_RETURNTRANSFER => true
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo "Short URL: " . $data["shortUrl"];
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]string{
"url": "https://example.com",
})
resp, _ := http.Post(
"https://s.zetri.my.id/api/shorten",
"application/json",
bytes.NewBuffer(body),
)
var result struct {
ShortUrl string `json:"shortUrl"`
Code string `json:"code"`
}
json.NewDecoder(resp.Body).Decode(&result)
resp.Body.Close()
fmt.Println("Short URL:", result.ShortUrl)
}
| Aturan | Nilai |
|---|---|
| Maks. panjang URL | 2048 karakter |
| Panjang short code | 6 karakter |
| Rate limit | 10 req/detik per IP |
| HTTPS | Wajib (HTTP otomatis redirect) |
| Masa berlaku | Permanent |