VPS.org API

เอกสาร REST API

API ตำแหน่งที่ตั้ง

แสดงรายการตำแหน่งที่คุณสามารถติดตั้ง VPS ได้ ใช้ค่าหมายเลขของตำแหน่งเป็น location_ id เมื่อคุณสร้างเซิร์ฟเวอร์

จุดสิ้นสุด 2 endpoints
เส้นทางฐาน /api/v1/locations
รับ /api/v1/locations/

แสดงสถานที่ทั้งหมด

เรียกดูรายการของสถานที่ศูนย์ข้อมูลที่คุณสามารถใช้เซิร์ฟเวอร์ VPS ได้

ตัวอย่างคำขอ

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}/

หาตำแหน่ง

เรียกคืนตำแหน่งที่อยู่ด้วยหมายเลขของมัน คำตอบคือ สิ่งมีชีวิตที่อยู่ที่อยู่หนึ่ง ด้วยช่องข้อมูลด้านบน

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
}

ที่ที่เซิร์ฟเวอร์ของคุณทำงาน

เซิร์ฟเวอร์ VPS.org ทุกตัว ปัจจุบันทำงานอยู่ในนิวเจอร์ซีย์ สหรัฐอเมริกา ซึ่งให้บริการลูกค้าทั่วโลกผ่านทาง IPv4 และ IPv6 อ่านจุดจบของตำแหน่งเสมอ แทนที่จะเขียนรหัสผ่าน ดังนั้นการรวมเข้ากันของคุณจะรับตำแหน่งใหม่เมื่อมันถูกเพิ่ม