VPS.org API

REST API ကိုစာရွက်စာတမ်းများ

တည်နေရာ API

သင်သည် VPS ကိုဖြန့်ချိနိုင်သည့်နေရာများစာရင်း။ သင်သည်ဆာဗာတစ်ခုဖန်တီးတဲ့အခါ location_id အဖြစ်နေရာတစ်ခု၏ id ကိုပေးပို့ပါ။

အဆုံးမှတ်များ 2 endpoints
အခြေခံလမ်းကြောင်း /api/v1/locations
ရယူပါ /api/v1/locations/

တည်နေရာအားလုံးကို စာရင်းပြုစုပါ

သင် VPS ဆာဗာများဖြန့်ချိနိုင်သည့်နေရာတိုင်းရရှိနိုင် datacenter တည်နေရာများ၏စာရင်းကိုရယူပါ။

နမူနာတောင်းဆိုချက်

cURL
Python
JavaScript
PHP
curl -X GET "https://admin.vps.org/api/v1/locations/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

url = "https://admin.vps.org/api/v1/locations/"
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/locations/', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

const locations = await response.json();
console.log(locations);
$ch = curl_init('https://admin.vps.org/api/v1/locations/');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$locations = json_decode($response, true);
curl_close($ch);

ဥပမာတုံ့ပြန်မှု

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "New Jersey",
      "country_name": "United States",
      "country_code": "US",
      "is_active": true
    }
  ]
}

တုံ့ပြန်မှု ကွက်လပ်များ

နယ်မြေ အမျိုးအစား ဖော်ပြချက်
id integer တည်နေရာအမည်၊ ဆာဗာတစ်ခုဖန်တီးတဲ့အခါ location_id အဖြစ်အသုံးပြုပါ။
name string လူဖတ်နိုင်သော တည်နေရာအမည်
country_name string တည်နေရာ
country_code string ISO 3166-1 alpha-2 တိုင်းပြည်ကုဒ်
is_active boolean တည်နေရာက ဆာဗာအသစ်များကို လက်ခံပါသလား

တုံ့ပြန်မှု အခြေအနေ ကုဒ်များ

200 တည်နေရာစာရင်းကို အောင်မြင်စွာ ရယူပြီးပါပြီ
403 API token မပါဘဲ သို့မဟုတ် မမှန်ကန်ပါ၊ သို့မဟုတ် token သည်လိုအပ်သောခွင့်ပြုချက်မရှိပါ
ရယူပါ /api/v1/locations/{id}/

တည်နေရာကိုရယူပါ

၎င်း၏ id ကိုအားဖြင့်တစ်ဦးတည်းသောနေရာကိုရယူပါ. တုံ့ပြန်မှုအပေါ်က Fields များနှင့်အတူတစ်နေရာတည်းမှာ object ကိုဖြစ်ပါသည်.

curl -X GET "https://admin.vps.org/api/v1/locations/1/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "id": 1,
  "name": "New Jersey",
  "country_name": "United States",
  "country_code": "US",
  "is_active": true
}

သင်၏ဆာဗာများ Run နေရာ

အားလုံး VPS.org server ကိုလက်ရှိကျွန်တော်တို့ရဲ့နယူးဂျာစီမှာ runs, အမေရိကန်နိုင်ငံတည်နေရာ, IPv4 နှင့် IPv6 ကျော်ကမ္ဘာတစ်ဝှမ်းဖောက်သည်များကိုဝန်ဆောင်မှုပေးသော. အမြဲတစ်ဦး id ကို hardcoding ထက်နေရာများ endpoint ကိုဖတ်ပါ, သူတို့ထည့်သွင်းတဲ့အခါသင့်ရဲ့ပေါင်းစည်းမှုအသစ်နေရာများ picks up so.