by @manzxy
Platform snippet code open untuk developer Indonesia.
Simpan, share, dan temukan kode siap pakai — gratis selamanya.
Ada pertanyaan, bug report, atau mau kolaborasi? Hit up Manzxy lewat salah satu kanal di bawah.
Base URL: https://manzxy.biz.id/api
Semua response dalam format application/json
snippet_key_hash tidak disertakan.curl https://manzxy.biz.id/api/snippets[
{
"id": 1,
"created_at": "2026-03-15T10:00:00Z",
"author": "manzxy",
"title": "Fetch Retry",
"description": "Auto-retry fetch dengan exponential backoff",
"language": "JavaScript",
"tags": ["fetch", "async"],
"code": "async function fetchRetry...",
"likes": 12,
"views": 87
}
]fetch('https://manzxy.biz.id/api/snippets', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'like', id: 1 }) })
{ "likes": 13 }{ "views": 88 }{ "error": "Terlalu cepat, tunggu sebentar", "likes": 13 }curl -X POST https://manzxy.biz.id/api/snippet-create \ -H 'Content-Type: application/json' \ -d '{ "author": "manzxy", "title": "Fetch Retry", "description": "Auto-retry fetch dengan backoff", "language": "JavaScript", "tags": "fetch, async, utility", "code": "async function fetchRetry(url, n=3) {...}", "snippetKey": "abc12" }'
{ "ok": true }{
"errors": {
"author": "Wajib diisi",
"snippetKey": "Key harus 3–7 karakter"
}
}snippetKey asli ATAU session admin cookie (mzx_token). Minimal satu field opsional harus diisi.{ "ok": true }{ "error": "Key salah!" }curl -X DELETE https://manzxy.biz.id/api/snippet-action \ -H 'Content-Type: application/json' \ -d '{"id": 1, "snippetKey": "abc12"}'
{ "ok": true }{
"status": "ok",
"app": "ManzxyCodes",
"version": "1.0.0",
"env": "production",
"uptime": "3600s",
"ts": "2026-03-15T10:00:00.000Z"
}ADMIN_USERNAMEmzx_token sebagai HttpOnly, SameSite=Lax. Cookie tidak bisa diakses JS browser. Berlaku 8 jam.{ "ok": true }
// Header: Set-Cookie: mzx_token=eyJ...; HttpOnly; SameSite=Lax; Max-Age=28800{ "error": "Username atau password salah" }{ "error": "Terlalu banyak request. Coba lagi nanti." }mzx_token dikirim otomatis browser jika sudah login. Selalu return 200 — cek nilai admin untuk tahu status.curl -b "mzx_token=eyJ..." https://manzxy.biz.id/api/admin-verify
{ "admin": true }{ "admin": false }{ "ok": true }
// Header: Set-Cookie: mzx_token=; Max-Age=0// 1. Login POST /api/admin-login { username, password } → server hash password + salt → compare ADMIN_PASSWORD_HASH → jika cocok: buat JWT (expire 8h) → Set-Cookie: mzx_token // 2. Gunakan admin session PUT /api/snippet-action { id, title, code } → browser kirim cookie mzx_token otomatis → server verify JWT → bypass snippet key check // 3. Cek session masih aktif GET /api/admin-verify → { admin: true } jika valid, { admin: false } jika expired // 4. Logout POST /api/admin-logout → server clear cookie (Max-Age=0)
import requests, json BASE = "https://manzxy.biz.id" def get_all(): r = requests.get(f"{BASE}/api/snippets") r.raise_for_status() return r.json() def by_lang(snippets, lang): return [s for s in snippets if s["language"] == lang] def upload(author, title, desc, lang, tags, code, key): r = requests.post(f"{BASE}/api/snippet-create", json={ "author": author, "title": title, "description": desc, "language": lang, "tags": tags, "code": code, "snippetKey": key }) return r.json() def delete_snippet(id, key): r = requests.delete(f"{BASE}/api/snippet-action", json={"id": id, "snippetKey": key}) return r.json() if __name__ == "__main__": data = get_all() print(f"Total: {len(data)} snippets") js = by_lang(data, "JavaScript") print(f"JS snippets: {len(js)}") # Export ke JSON with open("snippets.json", "w") as f: json.dump(data, f, indent=2, ensure_ascii=False)
// node scraper.js const BASE = 'https://manzxy.biz.id'; async function fetchAll() { const r = await fetch(`${BASE}/api/snippets`); if (!r.ok) throw new Error(`HTTP ${r.status}`); return r.json(); } async function upload(payload) { const r = await fetch(`${BASE}/api/snippet-create`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); return r.json(); } async function deleteSnippet(id, key) { const r = await fetch(`${BASE}/api/snippet-action`, { method: 'DELETE', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id, snippetKey: key }) }); return r.json(); } (async () => { const all = await fetchAll(); console.log(`Total: ${all.length}`); const top = [...all].sort((a,b) => b.likes - a.likes)[0]; console.log('Top liked:', top?.title); })();
<?php $BASE = "https://manzxy.biz.id"; function apiGet($url) { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Accept: application/json'] ]); $body = curl_exec($ch); curl_close($ch); return json_decode($body, true); } function apiPost($url, $data, $method = 'POST') { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => ['Content-Type: application/json'] ]); $body = curl_exec($ch); curl_close($ch); return json_decode($body, true); } // Ambil semua snippet $snippets = apiGet("$BASE/api/snippets"); echo "Total: " . count($snippets) . " snippets\n"; // Upload snippet baru $result = apiPost("$BASE/api/snippet-create", [ "author" => "manzxy", "title" => "PHP Helper", "description"=> "Useful PHP functions", "language" => "PHP", "tags" => "php, utility", "code" => "function helper() {...}", "snippetKey" => "mykey" ]); echo json_encode($result);
"error": "pesan error". Error validasi menyertakan "errors": {...}.errors object per-field./api/health untuk status server.