Perkenalan
Selamat datang di dokumentasi API WLJ Cloud. API ini memungkinkan Anda untuk mengelola server, membuat order, mengontrol VM, dan melakukan berbagai operasi lainnya secara programatik.
Base URL: https://api.wlj-cloud.id/api/v1
Semua endpoint API menggunakan format JSON untuk request dan response.
Perkenalan
API WLJ Cloud menggunakan Bearer Token authentication. Anda harus menyertakan API key Anda di header Authorization untuk setiap request.
Authorization: Bearer wlj_live_your_api_key_here
Contoh Request dengan cURL:
curl -X GET "https://api.wlj-cloud.id/api/v1/account/info" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Perkenalan
API menggunakan HTTP status codes standar dan mengembalikan error dalam format JSON yang konsisten:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Deskripsi error yang mudah dipahami"
}
}
| Status Code | Arti | Deskripsi |
|---|---|---|
| 200 | OK | Request berhasil diproses |
| 201 | Created | Resource berhasil dibuat |
| 400 | Bad Request | Request tidak valid atau parameter salah |
| 401 | Unauthorized | API key tidak valid atau tidak ada |
| 404 | Not Found | Resource tidak ditemukan |
| Status Code | Deskripsi |
|---|---|
INVALID_API_KEY |
API key tidak valid atau sudah expired |
INVALID_INPUT |
Parameter request tidak valid |
INSUFFICIENT_BALANCE |
Saldo tidak cukup untuk melakukan transaksi |
ORDER_NOT_FOUND |
Order dengan ID tersebut tidak ditemukan |
PACKAGE_OUT_OF_STOCK |
Paket yang dipilih tidak tersedia |
JOB_NOT_FOUND |
Job dengan ID tersebut tidak ditemukan |
Perkenalan
API menerapkan rate limiting untuk melindungi sistem dari penyalahgunaan. Informasi rate limit tersedia di response headers setiap request.
| Header | Deskripsi |
|---|---|
RateLimit-Limit |
Jumlah maksimal request yang diizinkan per window |
RateLimit-Remaining |
Jumlah request yang tersisa dalam window saat ini |
RateLimit-Reset |
Waktu (dalam detik) hingga reset window |
RateLimit-Policy |
Kebijakan rate limit (format: limit;w=window_seconds) |
| Kategori Endpoint | Limit | Window |
|---|---|---|
| General (Account, Orders, dll) | 2000 requests | 15 Menit |
| Packages | 500 requests | 15 menit |
| Create Order | 100 requests | 1 jam |
Account
Endpoint ini mengembalikan informasi detail tentang akun Anda.
https://api.wlj-cloud.id/api/v1/account/info
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/account/info" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": {
"username": "testing_user",
"email": "[email protected]",
"balance": 9965996,
"role": "reseller",
"webhook_url": "http://localhost:3000",
"whitelist_ips": "::1"
}
}
{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key"
}
}
Account
Endpoint ini mengembalikan riwayat transaksi akun dengan pagination.
https://api.wlj-cloud.id/api/v1/account/transactions
Query Parameters
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
limit |
number | TIDAK | Jumlah data per halaman (default: 10) |
offset |
number | Tidak | Offset data (default: 0) |
type |
string | Tidak | Filter tipe transaksi: order, renewal, deposit, refund |
REQUEST
curl -X GET "https://api.wlj-cloud.id/api/v1/account/transactions?limit=10&offset=0&type=order" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": [
{
"transaction_id": "7767a479-f7a1-4b52-8cad-23fd62db2068",
"type": "order",
"amount": 1,
"description": "Order created: my-vps-server (monthly)",
"orderid": "becb8fb1-edd2-4155-a244-1ce0c9443fd1",
"status": "completed",
"created_at": "2025-12-30T18:24:39.784Z"
}
],
"pagination": {
"total": 5,
"limit": 10,
"offset": 0,
"hasMore": false
}
}
Servers
Endpoint ini mengembalikan daftar semua server yang tersedia.
https://api.wlj-cloud.id/api/v1/servers
request
curl -X GET "https://api.wlj-cloud.id/api/v1/servers" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
response
{
"success": true,
"data": [
{
"serverid": "jakarta-1",
"server_name": "Jakarta DC1",
"location": "Indonesia",
"status": "active",
"created_at": "2025-11-19T11:24:25.386Z"
}
]
}
Servers
Endpoint ini mengembalikan daftar template OS yang tersedia untuk server tertentu.
https://api.wlj-cloud.id/api/v1/servers/{serverid}/os-templates
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
serverid |
string | Ya | ID server yang ingin dicek template OS-nya |
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/servers/jakarta-1/os-templates" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": [
{
"osid": "3cd7fdd4-802c-4af6-8efd-a8935d4a031f",
"os_name": "Windows Server 2019",
"type": "windows",
"template_id": 9001,
"created_at": "2025-11-22T02:49:24.335Z"
},
{
"osid": "d2da8da1-0580-4939-8807-3a1fdfa95003",
"os_name": "Ubuntu",
"type": "linux",
"template_id": 9000,
"created_at": "2025-11-19T11:48:28.951Z"
}
]
}
{
"success": false,
"error": {
"code": "SERVER_NOT_FOUND",
"message": "Server not found"
}
}
{
"success": false,
"message": "Unauthorized"
}
Packages
Endpoint ini mengembalikan daftar semua paket VM yang tersedia.
https://api.wlj-cloud.id/api/v1/packages
Query Parameters (Optional)
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
serverid |
string | Tidak | Filter paket berdasarkan server tertentu |
type |
string | Tidak | Filter paket berdasarkan tipe: linux atau windows |
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/packages?serverid=jakarta-1&type=linux" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": [
{
"package_id": "48d24c1f-1f03-49f5-90c3-c8138e5aa009",
"name": "Si Mungil",
"serverid": "jktcyber1",
"server_name": "Jakarta DC1",
"location": "Indonesia",
"cpu": 1,
"ram": 1024,
"disk": "20G",
"network_type": "nat",
"enable_windows": false,
"daily_price": null,
"weekly_price": null,
"monthly_price": 1,
"stock": 4,
"is_active": true
}
]
}
Packages
Endpoint ini mengembalikan informasi detail tentang paket tertentu.
https://api.wlj-cloud.id/api/v1/packages/{packageId}
Path Parameters
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
packageId |
string | Ya | ID paket yang ingin dilihat detailnya |
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/packages/48d24c1f-1f03-49f5-90c3-c8138e5aa009" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Responses
{
"success": true,
"data": {
"package_id": "48d24c1f-1f03-49f5-90c3-c8138e5aa009",
"name": "Si Mungil",
"serverid": "jktcyber1",
"server_name": "Jakarta DC1",
"location": "Indonesia",
"server_status": "active",
"cpu": 1,
"ram": 1024,
"disk": "20G",
"network_type": "nat",
"enable_windows": false,
"enable_daily": false,
"enable_weekly": false,
"enable_monthly": true,
"daily_price": null,
"weekly_price": null,
"monthly_price": 1,
"stock": 4,
"is_active": true,
"created_at": "2025-11-28T14:44:35.915Z"
}
}
Orders
Endpoint ini digunakan untuk membuat order VM baru.
https://api.wlj-cloud.id/api/v1/orders/create
Request Body
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
vm_name |
string | Ya | Nama VM yang akan dibuat |
serverid |
string | Ya | ID server tempat VM akan dibuat |
osid |
string (UUID) | Ya | ID template OS yang akan digunakan |
package_id |
string (UUID) | Ya | ID paket yang akan digunakan |
billing_cycle |
string | Ya | Siklus pembayaran: daily, weekly, atau monthly |
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/create" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"vm_name": "my-vps-server",
"serverid": "jakarta-1",
"osid": "3cd7fdd4-802c-4af6-8efd-a8935d4a031f",
"package_id": "f1117f8f-85c3-49f7-8aa0-3b9b531788d0",
"billing_cycle": "monthly"
}'
{
"success": true,
"data": {
"orderid": "88b8ec89-560b-4bbc-baa9-f06b2944bb3b",
"vm_name": "my-vps-server",
"price": 70000,
"status": "pending",
"expired_at": "2026-02-01T06:45:17.612Z",
"created_at": "2026-01-01T06:45:17.634Z"
},
"message": "Order created successfully"
}
{
"success": false,
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance. Required: Rp 70.000, Available: Rp 0"
}
}
{
"success": false,
"error": {
"code": "PACKAGE_OUT_OF_STOCK",
"message": "Selected package is out of stock"
}
}
Orders
Endpoint ini mengembalikan daftar semua order dengan pagination.
https://api.wlj-cloud.id/api/v1/orders
Query Parameters
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
limit |
number | Ya | Jumlah data per halaman (default: 10) |
offset |
number | Tidak | Offset data (default: 0) |
status |
string | Tidak | Filter status: pending, active, suspended, expired, cancelled |
Requests
curl -X GET "https://api.wlj-cloud.id/api/v1/orders?limit=10&offset=0&status=active" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": [
{
"orderid": "674801fe-6b03-4a11-8e2f-e93e66a39b57",
"vm_name": "my-vps-server1",
"package_name": "Tes Package",
"server_name": "Jakarta DC1",
"os_name": "Windows Server 2019",
"cpu": 2,
"ram": 4096,
"disk": "40G",
"ipvm": "192.168.111.245",
"network_type": "public_ip",
"status": "active",
"expired_at": "2026-02-01T07:09:55.386Z",
"created_at": "2026-01-01T07:09:55.448Z"
}
],
"pagination": {
"total": 3,
"limit": 10,
"offset": 0,
"hasMore": false
}
}
Orders
Endpoint ini mengembalikan informasi lengkap tentang order tertentu, termasuk credentials dan port forwarding (untuk NAT).
https://api.wlj-cloud.id/api/v1/orders/{orderid}
Path Parameters
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
orderid |
string (UUID) | Ya | ID order yang ingin dilihat detailnya |
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": {
"orderid": "674801fe-6b03-4a11-8e2f-e93e66a39b57",
"vm_name": "my-vps-server1",
"package_name": "Tes Package",
"server_name": "Jakarta DC1",
"location": "Indonesia",
"os_name": "Windows Server 2019",
"os_type": "windows",
"cpu": 2,
"ram": 4096,
"disk": "40G",
"ipvm": "192.168.111.245",
"usernamevm": "admin/administrator",
"passwordvm": "Tv8DevEg4lr2dkYW",
"network_type": "public_ip",
"status": "active",
"expired_at": "2026-02-01T07:09:55.386Z",
"created_at": "2026-01-01T07:09:55.448Z"
}
}
{
"success": true,
"data": {
"orderid": "becb8fb1-edd2-4155-a244-1ce0c9443fd1",
"vm_name": "my-vps-server",
"package_name": "Si Mungil",
"server_name": "Jakarta DC1",
"location": "Indonesia",
"os_name": "Ubuntu",
"os_type": "linux",
"cpu": 1,
"ram": 1024,
"disk": "20G",
"ipvm": null,
"usernamevm": "debian/root",
"passwordvm": "Au1OTqN3dnIa",
"network_type": "nat",
"status": "active",
"expired_at": "2026-03-02T18:24:39.674Z",
"created_at": "2025-12-30T18:24:39.696Z",
"public_ip": "192.168.111.65",
"private_ip": "10.10.10.14",
"allocated_ports": [
{
"port_id": 19,
"public_port": 50060,
"private_port": 22,
"protocol": "tcp",
"description": "SSH",
"is_used": true
}
],
"available_ports": [
{
"public_port": 50062,
"is_used": false
}
]
}
}
Orders
Endpoint ini digunakan untuk memperpanjang masa aktif order.
https://api.wlj-cloud.id/api/v1/orders/{orderid}/extend
Request Body
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
billing_cycle |
string | Ya | Durasi perpanjangan: daily, weekly, atau monthly |
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57/extend" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"billing_cycle": "monthly"}'
Response
{
"success": true,
"data": {
"orderid": "674801fe-6b03-4a11-8e2f-e93e66a39b57",
"new_expiry": "2026-03-01T07:09:55.386Z",
"price_paid": 70000,
"status": "active"
},
"message": "Order extended successfully"
}
{
"success": false,
"error": {
"code": "INVALID_INPUT",
"message": "Selected billing cycle is not available for this package."
}
}
Orders
Endpoint ini digunakan untuk reinstall VM dengan OS yang berbeda. Proses ini akan menghapus semua data di VM.
https://api.wlj-cloud.id/api/v1/orders/{orderid}/reinstall
Perhatian: Reinstall akan menghapus semua data di VM. Pastikan Anda telah melakukan backup terlebih dahulu.
Request Body
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
osid |
string (UUID) | Ya | ID template OS baru yang akan digunakan |
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57/reinstall" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"osid": "d7618e94-3ce1-4b8c-87c4-6708c2ef4b72"}'
Response
{
"success": true,
"data": {
"jobId": "40b61076-9cfe-46b9-85aa-dab7c88efd13",
"message": "VM reinstall has been queued. This may take a few minutes.",
"new_os": "Windows 10 Pro"
}
}
Catatan: Reinstall bersifat asynchronous. Gunakan endpoint Job Query untuk mengecek status proses reinstall.
VM Power
Endpoint ini digunakan untuk menghidupkan VM yang sedang mati.
https://api.wlj-cloud.id/api/v1/orders/{orderid}/start
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57/start" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
{
"success": true,
"data": {
"jobId": "23db2133-13f8-4a40-9262-9fdba4e0c1d6",
"message": "VM start action has been queued successfully"
}
}
VM Power
Endpoint ini melakukan hard stop pada VM (sama seperti mencabut kabel power).
https://api.wlj-cloud.id/api/v1/orders/{orderid}/stop
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57/stop" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": {
"jobId": "10211c58-339a-475a-87f5-59c52add402a",
"message": "VM stop action has been queued successfully"
}
}
VM Power
Endpoint ini melakukan restart pada VM yang sedang berjalan.
https://api.wlj-cloud.id/api/v1/orders/{orderid}/restart
request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57/restart" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
response
{
"success": true,
"data": {
"jobId": "15f5b5bd-1d7c-473e-90e0-abae742b2f83",
"message": "VM restart action has been queued successfully"
}
}
VM Power
Endpoint ini melakukan graceful shutdown pada VM (sistem operasi akan mematikan dengan benar).
https://api.wlj-cloud.id/api/v1/orders/{orderid}/shutdown
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/674801fe-6b03-4a11-8e2f-e93e66a39b57/shutdown" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": {
"jobId": "217c9d78-7a0a-4656-abec-3b3ef26ece09",
"message": "VM shutdown action has been queued successfully"
}
}
Port Forwarding
Endpoint ini digunakan untuk menambahkan rule port forwarding baru pada VM NAT.
https://api.wlj-cloud.id/api/v1/orders/port-forward
Catatan: Endpoint ini hanya untuk VM dengan network_type "nat"
Request Body
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
orderid |
string (UUID) | Ya | ID order VM NAT |
public_port |
number | Ya | Port publik yang akan digunakan (dari available_ports) |
private_port |
number | Ya | Port di VM yang akan di-forward |
protocol |
string | Ya | Protokol: tcp atau udp |
description |
string | Tidak | Deskripsi port forwarding |
Request
curl -X POST "https://api.wlj-cloud.id/api/v1/orders/port-forward" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"orderid": "becb8fb1-edd2-4155-a244-1ce0c9443fd1",
"public_port": 50062,
"private_port": 80,
"protocol": "tcp",
"description": "Web Application"
}'
Response
{
"success": true,
"data": {
"id": 22,
"jobId": "c4678292-3bad-4921-8304-4dc2aad01f76",
"public_port": 50062,
"private_port": 80,
"protocol": "tcp",
"message": "Port forward has been queued successfully"
}
}
Port Forwarding
Endpoint ini mengembalikan semua rule port forwarding yang sudah dikonfigurasi pada VM NAT.
https://api.wlj-cloud.id/api/v1/orders/{orderid}/port-forwards
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/orders/becb8fb1-edd2-4155-a244-1ce0c9443fd1/port-forwards" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
{
"success": true,
"data": [
{
"id": 19,
"public_port": 50060,
"private_port": 22,
"protocol": "tcp",
"description": "SSH",
"created_at": "2025-12-30T18:25:12.650Z"
},
{
"id": 20,
"public_port": 50061,
"private_port": 80,
"protocol": "tcp",
"description": "Web Server",
"created_at": "2025-12-30T18:37:09.851Z"
}
]
}
Port Forwarding
Endpoint ini digunakan untuk mengubah konfigurasi port forwarding yang sudah ada.
https://api.wlj-cloud.id/api/v1/orders/port-forward/{portForwardId}
Request Body
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
public_port |
number | Ya | Port publik baru (dari available_ports) |
private_port |
number | Ya | Port private baru di VM |
protocol |
string | Ya | Protokol: tcp atau udp |
description |
string | Tidak | Deskripsi baru |
Request
curl -X PUT "https://api.wlj-cloud.id/api/v1/orders/port-forward/21" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"private_port": 8080,
"description": "Updated Web Application"
}'
Response
{
"success": true,
"data": {
"jobId": "03f798e5-e4fd-4173-8308-1b84decce15c",
"message": "Port forward update has been queued successfully",
"portForward": {
"id": 21,
"public_port": 50069,
"private_port": 8080,
"protocol": "tcp",
"description": "Updated Web Application"
}
}
}
Job Status
Endpoint ini digunakan untuk mengecek status dari operasi asynchronous (reinstall, VM power actions, port forwarding).
https://api.wlj-cloud.id/api/v1/job/{jobid}
Path Parameters
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
jobid |
string (UUID) | Ya | ID job yang ingin dicek statusnya |
Request
curl -X GET "https://api.wlj-cloud.id/api/v1/job/40b61076-9cfe-46b9-85aa-dab7c88efd13" \
-H "Authorization: Bearer wlj_live_your_api_key_here"
Response
{
"success": true,
"data": {
"jobid": "40b61076-9cfe-46b9-85aa-dab7c88efd13",
"orderid": "674801fe-6b03-4a11-8e2f-e93e66a39b57",
"vm_name": "my-vps-server1",
"action": "reinstall",
"status": "completed",
"payload": {
"osid": "d7618e94-3ce1-4b8c-87c4-6708c2ef4b72",
"os_name": "Windows 10 Pro",
"old_osid": "3cd7fdd4-802c-4af6-8efd-a8935d4a031f",
"old_os_name": "Windows Server 2019"
},
"note": null,
"created_at": "2026-01-01T07:35:54.875Z",
"updated_at": "2026-01-01T07:36:28.553Z"
}
}
Job Status Values
| Status | Deskripsi |
|---|---|
pending |
Job sedang dalam antrian |
processing |
Job sedang diproses |
completed |
Job selesai dengan sukses |
failed |
Job gagal diproses |
Console
Sistem console kami mendukung dua metode akses VNC untuk memberikan fleksibilitas maksimal kepada reseller.
Metode Akses Console
Catatan: Ticket console bersifat one-time use only dan akan expired setelah digunakan atau dalam waktu tertentu.
1. HTTP Method (Direct Access)
Metode ini memberikan akses langsung ke server console kami. URL yang digenerate akan membawa user langsung ke console interface yang di-host di server kami. Cocok untuk reseller yang ingin memberikan akses console cepat tanpa setup tambahan.
Use Case: Redirect user langsung ke console web kami. Tidak perlu setup server atau implementasi WebSocket di sisi reseller.
2. WebSocket Method (VNC Behind Proxy)
Metode ini memungkinkan reseller untuk membuat console interface sendiri dan menghubungkan ke server kami melalui WebSocket. Ticket yang digenerate berisi informasi WebSocket connection untuk terhubung ke VNC server.
Use Case: Untuk reseller yang ingin mengintegrasikan console ke dalam platform mereka sendiri dengan branding custom.
Alur Koneksi WebSocket (VNC Behind Proxy)
Client Browser → Your Server → WSS Connection to Our Backend → WSS VNC to VM Server
1. Client membuka halaman console di website reseller
2. Reseller's server request ticket dengan method "websocket"
3. Reseller's frontend connect ke WSS endpoint kami menggunakan ticket
4. Backend kami meneruskan koneksi ke VNC server VM
5. Client dapat mengakses VM console melalui interface reseller
Catatan: Untuk metode WebSocket, reseller perlu mengimplementasikan VNC client di frontend mereka. Kami merekomendasikan menggunakan library noVNC
Console
Endpoint ini digunakan untuk membuat ticket console dengan metode HTTP atau WebSocket.
https://api.wlj-cloud.id/api/v1/vnc/ticket/request
Request Body
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
orderid |
string (UUID) | Ya | UUID dari order yang ingin diakses console-nya |
method |
string | Tidak | Metode akses: "http" atau "websocket". Default: "http" |
Request Example - HTTP Method
curl -X POST "https://api.wlj-cloud.id/api/v1/vnc/ticket/request" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"orderid": "bea2eda4-f186-46f9-ab6a-7bb44727d48d",
"method": "http"
}'
{
"success": true,
"data": {
"ticket": "d55d56d6-25a2-4c04-a16e-88df0055a881",
"orderid": "bea2eda4-f186-46f9-ab6a-7bb44727d48d",
"vm_name": "test-cross-os",
"http_url": "https://id-jakarta-cy1-console-http.wlj-cloud.id/ticket/d55d56d6-25a2-4c04-a16e-88df0055a881"
},
"message": "VNC ticket generated successfully. This ticket is one-time use only."
}
Request Example - WebSocket Method
curl -X POST "https://api.wlj-cloud.id/api/v1/vnc/ticket/request" \
-H "Authorization: Bearer wlj_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"orderid": "bea2eda4-f186-46f9-ab6a-7bb44727d48d",
"method": "websocket"
}'
Response
{
"success": true,
"data": {
"ticket": "a8f3b2c1-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
"orderid": "bea2eda4-f186-46f9-ab6a-7bb44727d48d",
"vm_name": "test-cross-os",
"websocket_url": "ws://id-jakarta-cy1-console-ws.wlj-cloud.id/vnc/ticket/d45419b0-7cb3-46d5-a636-c19c8c5b081a
},
"message": "VNC ticket generated successfully. This ticket is one-time use only."
}
Response Fields
| Field | Type | Deskripsi |
|---|---|---|
ticket |
string (UUID) | Ticket ID untuk akses console (one-time use) |
orderid |
string (UUID) | Order ID yang terkait dengan console |
vm_name |
string | Nama VM |
http_url |
string | (HTTP Method) URL untuk akses console langsung |
websocket_url |
string | (WebSocket Method) WSS URL untuk koneksi VNC client |
Implementasi WebSocket Client (noVNC)
import RFB from '@novnc/novnc/core/rfb.js';
// 1. Request ticket dari API
const response = await fetch('https://api.your-reseller.com/vnc/ticket', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
orderid: 'bea2eda4-f186-46f9-ab6a-7bb44727d48d',
method: 'websocket'
})
});
const { data } = await response.json();
// 2. Connect ke VNC menggunakan noVNC
const rfb = new RFB(
document.getElementById('vnc-screen'),
data.websocket_url,
{ credentials: { password: '' } }
);
// 3. Handle events
rfb.addEventListener('connect', () => {
console.log('Connected to VNC');
});
rfb.addEventListener('disconnect', () => {
console.log('Disconnected from VNC');
});