සියලුම සේවාදායක ලැයිස්තුගත කරන්න
ඔබගේ ගිණුමේ ඇති සියලුම සේවාදායක ලැයිස්තුවක් ලබා ගන්න.
විමසුම් පරාමිතීන්
| පරාමිතිය |
වර්ගය |
අවශ්යයි |
විස්තර |
status |
නූල |
නැත |
සේවාදායක තත්ත්වය අනුව පෙරහන් කරන්න: සක්රිය, නතර, අත්හිටුවන ලදී |
location |
නූල |
නැත |
දත්ත මධ්යස්ථාන ස්ථානය අනුව පෙරහන් කරන්න |
උදාහරණ ඉල්ලීම
cURL
Python
JavaScript
PHP
curl -X GET "https://admin.vps.org/api/v1/servers/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
import requests
url = "https://admin.vps.org/api/v1/servers/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/servers/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
});
const servers = await response.json();
console.log(servers);
$ch = curl_init('https://admin.vps.org/api/v1/servers/');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_TOKEN',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$servers = json_decode($response, true);
curl_close($ch);
උදාහරණ ප්රතිචාරය
{
"count": 2,
"results": [
{
"id": 12345,
"name": "web-server-01",
"hostname": "web01.example.com",
"status": "active",
"ip_address": "203.0.113.10",
"location": "us-west",
"plan": {
"id": 1,
"name": "Standard VPS",
"vcpus": 2,
"memory": 4096,
"storage": 80
},
"os": {
"id": 5,
"name": "Ubuntu 22.04 LTS"
},
"created_at": "2025-01-10T14:30:00Z",
"updated_at": "2025-01-15T10:20:00Z"
},
{
"id": 12346,
"name": "db-server-01",
"hostname": "db01.example.com",
"status": "active",
"ip_address": "203.0.113.11",
"location": "us-east",
"plan": {
"id": 2,
"name": "Performance VPS",
"vcpus": 4,
"memory": 8192,
"storage": 160
},
"os": {
"id": 3,
"name": "Debian 12"
},
"created_at": "2025-01-12T09:15:00Z",
"updated_at": "2025-01-16T08:45:00Z"
}
]
}
ප්රතිචාර තත්ව කේත
| 200 |
සේවාදායක ලැයිස්තුව සාර්ථකව ලබා ගන්නා ලදී. |
| 401 |
අනවසර - අවලංගු හෝ අතුරුදහන් වූ API ටෝකනය |
නව සේවාදායකයක් සාදන්න
නිශ්චිත වින්යාසයක් සහිත නව VPS සේවාදායකයක් යොදවන්න.
ඉල්ලීම් ශරීර පරාමිතීන්
| පරාමිතිය |
වර්ගය |
අවශ්යයි |
විස්තර |
name |
නූල |
ඔව් |
සේවාදායක නාමය (අක්ෂරාංක, යා ඉරි අවසර දී ඇත) |
plan_id |
පූර්ණ සංඛ්යාව |
ඔව් |
VPS සැලැස්මේ ID |
os_id |
පූර්ණ සංඛ්යාව |
ඔව් |
මෙහෙයුම් පද්ධතියේ හැඳුනුම්පත |
location |
නූල |
ඔව් |
දත්ත මධ්යස්ථාන ස්ථාන කේතය |
hostname |
නූල |
නැත |
සේවාදායක සත්කාරක නාමය (FQDN) |
ssh_key_id |
පූර්ණ සංඛ්යාව |
නැත |
ස්ථාපනය කිරීමට SSH යතුරු හැඳුනුම්පත |
backups_enabled |
බූලියන් |
නැත |
ස්වයංක්රීය උපස්ථ සක්රීය කරන්න (පෙරනිමිය: අසත්ය) |
උදාහරණ ඉල්ලීම
cURL
Python
JavaScript
PHP
curl -X POST "https://admin.vps.org/api/v1/servers/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "web-server-02",
"plan_id": 1,
"os_id": 5,
"location": "us-west",
"hostname": "web02.example.com",
"backups_enabled": true
}'
import requests
url = "https://admin.vps.org/api/v1/servers/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
data = {
"name": "web-server-02",
"plan_id": 1,
"os_id": 5,
"location": "us-west",
"hostname": "web02.example.com",
"backups_enabled": True
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/servers/', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'web-server-02',
plan_id: 1,
os_id: 5,
location: 'us-west',
hostname: 'web02.example.com',
backups_enabled: true
})
});
const server = await response.json();
console.log(server);
$data = [
'name' => 'web-server-02',
'plan_id' => 1,
'os_id' => 5,
'location' => 'us-west',
'hostname' => 'web02.example.com',
'backups_enabled' => true
];
$ch = curl_init('https://admin.vps.org/api/v1/servers/');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_TOKEN',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$server = json_decode($response, true);
curl_close($ch);
උදාහරණ ප්රතිචාරය
{
"id": 12347,
"name": "web-server-02",
"hostname": "web02.example.com",
"status": "provisioning",
"ip_address": null,
"location": "us-west",
"plan": {
"id": 1,
"name": "Standard VPS",
"vcpus": 2,
"memory": 4096,
"storage": 80
},
"os": {
"id": 5,
"name": "Ubuntu 22.04 LTS"
},
"backups_enabled": true,
"created_at": "2025-01-16T15:30:00Z",
"updated_at": "2025-01-16T15:30:00Z",
"message": "Server is being provisioned. This may take 2-5 minutes."
}
ප්රතිචාර තත්ව කේත
| 201 |
සේවාදායකය සාර්ථකව නිර්මාණය කරන ලදී |
| 400 |
වැරදි ඉල්ලීම - අවලංගු පරාමිතීන් |
| 401 |
අනවසර - අවලංගු හෝ අතුරුදහන් වූ API ටෝකනය |
| 402 |
ගෙවීම අවශ්යයි - ප්රමාණවත් ණය නොමැත. |
සේවාදායක විස්තර ලබා ගන්න
නිශ්චිත සේවාදායකයක් පිළිබඳ සවිස්තර තොරතුරු ලබා ගන්න.
මාර්ග පරාමිතීන්
| පරාමිතිය |
වර්ගය |
අවශ්යයි |
විස්තර |
server_id |
පූර්ණ සංඛ්යාව |
ඔව් |
අනන්ය සේවාදායක හැඳුනුම්පත |
උදාහරණ ඉල්ලීම
curl -X GET "https://admin.vps.org/api/v1/servers/12345/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
print(response.json())
const serverId = 12345;
const response = await fetch(`https://admin.vps.org/api/v1/servers/${serverId}/`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
});
const server = await response.json();
console.log(server);
උදාහරණ ප්රතිචාරය
{
"id": 12345,
"name": "web-server-01",
"hostname": "web01.example.com",
"status": "active",
"ip_address": "203.0.113.10",
"ipv6_address": "2001:0db8::1",
"location": "us-west",
"plan": {
"id": 1,
"name": "Standard VPS",
"vcpus": 2,
"memory": 4096,
"storage": 80,
"bandwidth": 2048
},
"os": {
"id": 5,
"name": "Ubuntu 22.04 LTS"
},
"backups_enabled": true,
"resource_usage": {
"cpu_percent": 23.5,
"memory_used": 2048,
"disk_used": 35,
"bandwidth_used": 450
},
"created_at": "2025-01-10T14:30:00Z",
"updated_at": "2025-01-16T15:45:00Z"
}
ප්රතිචාර තත්ව කේත
| 200 |
සේවාදායක විස්තර සාර්ථකව ලබා ගන්නා ලදී. |
| 401 |
අනවසර - අවලංගු හෝ අතුරුදහන් වූ API ටෝකනය |
| 404 |
හමු නොවීය - සේවාදායකය නොපවතී. |
සේවාදායකය යාවත්කාලීන කරන්න
සේවාදායක වින්යාසය යාවත්කාලීන කරන්න. සියලුම ක්ෂේත්ර අවශ්ය වේ.
මාර්ග පරාමිතීන්
| Parameter |
Type |
Required |
Description |
server_id |
integer |
Yes |
අනන්ය සේවාදායක හැඳුනුම්පත |
ඉල්ලීම් ශරීර පරාමිතීන්
| පරාමිතිය |
වර්ගය |
අවශ්යයි |
විස්තර |
name |
නූල |
ඔව් |
සේවාදායකයේ නම |
hostname |
නූල |
ඔව් |
සේවාදායක සත්කාරක නාමය (FQDN) |
backups_enabled |
බූලියන් |
ඔව් |
ස්වයංක්රීය උපස්ථ සක්රිය/අබල කරන්න |
උදාහරණ ඉල්ලීම
curl -X PUT "https://admin.vps.org/api/v1/servers/12345/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "web-server-updated",
"hostname": "web-updated.example.com",
"backups_enabled": true
}'
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
data = {
"name": "web-server-updated",
"hostname": "web-updated.example.com",
"backups_enabled": True
}
response = requests.put(url, headers=headers, json=data)
print(response.json())
ප්රතිචාර තත්ව කේත
| 200 |
සේවාදායකය සාර්ථකව යාවත්කාලීන කරන ලදී |
| 400 |
වැරදි ඉල්ලීම - අවලංගු පරාමිතීන් |
| 404 |
හමු නොවීය - සේවාදායකය නොපවතී. |
සේවාදායකය අර්ධ වශයෙන් යාවත්කාලීන කරන්න
නිශ්චිත සේවාදායක ක්ෂේත්ර යාවත්කාලීන කරන්න. සපයා ඇති ක්ෂේත්ර පමණක් යාවත්කාලීන කෙරේ.
උදාහරණ ඉල්ලීම
curl -X PATCH "https://admin.vps.org/api/v1/servers/12345/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "new-server-name"
}'
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
data = {"name": "new-server-name"}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
සේවාදායකය මකන්න
සේවාදායකයක් ස්ථිරවම මකන්න. මෙම ක්රියාව අහෝසි කළ නොහැක.
උදාහරණ ඉල්ලීම
curl -X DELETE "https://admin.vps.org/api/v1/servers/12345/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
response = requests.delete(url, headers=headers)
print(response.status_code)
ප්රතිචාර තත්ව කේත
| 204 |
සේවාදායකය සාර්ථකව මකා දමන ලදී |
| 404 |
හමු නොවීය - සේවාදායකය නොපවතී. |
සේවාදායකය ආරම්භ කරන්න
නතර වූ සේවාදායකයක් සක්රිය කරන්න.
උදාහරණ ඉල්ලීම
curl -X POST "https://admin.vps.org/api/v1/servers/12345/start/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/start/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
print(response.json())
const serverId = 12345;
const response = await fetch(`https://admin.vps.org/api/v1/servers/${serverId}/start/`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
});
const result = await response.json();
console.log(result);
උදාහරණ ප්රතිචාරය
{
"status": "success",
"message": "Server is starting",
"server": {
"id": 12345,
"name": "web-server-01",
"status": "starting"
}
}
ප්රතිචාර තත්ව කේත
| 200 |
සේවාදායක ආරම්භක විධානය සාර්ථකව යවන ලදී. |
| 400 |
වැරදි ඉල්ලීමක් - සේවාදායකය දැනටමත් ක්රියාත්මක වේ. |
| 404 |
හමු නොවීය - සේවාදායකය නොපවතී. |
සේවාදායකය නවත්වන්න
ක්රියාත්මක වන සේවාදායකයක් කරුණාවන්තව වසා දමන්න.
උදාහරණ ඉල්ලීම
curl -X POST "https://admin.vps.org/api/v1/servers/12345/stop/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/stop/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
print(response.json())
උදාහරණ ප්රතිචාරය
{
"status": "success",
"message": "Server is stopping",
"server": {
"id": 12345,
"name": "web-server-01",
"status": "stopping"
}
}
සේවාදායකය නැවත ආරම්භ කරන්න
ක්රියාත්මක වන සේවාදායකයක් කරුණාවෙන් නැවත ආරම්භ කරන්න.
උදාහරණ ඉල්ලීම
curl -X POST "https://admin.vps.org/api/v1/servers/12345/reboot/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
import requests
server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/reboot/"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
print(response.json())
උදාහරණ ප්රතිචාරය
{
"status": "success",
"message": "Server is rebooting",
"server": {
"id": 12345,
"name": "web-server-01",
"status": "rebooting"
}
}
ප්රතිචාර තත්ව කේත
| 200 |
සේවාදායකය නැවත පණගැන්වීමේ විධානය සාර්ථකව යවන ලදී. |
| 400 |
වැරදි ඉල්ලීමක් - සේවාදායකය ක්රියාත්මක නොවේ. |
| 404 |
හමු නොවීය - සේවාදායකය නොපවතී. |