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. ອ່ານຈຸດສຸດທ້າຍສະຖານທີ່ເປັນປົກກະຕິແທນທີ່ຈະເປັນ hardcoding ລະຫັດ, ດັ່ງນັ້ນການລວມຕົວຂອງທ່ານ picks up new locations when they are added.