VPS.org API

Àwọn Àkọsílẹ̀ API REST

API Àwọn Ipò

Fi àtòjọ àwọn ààyè-iṣẹ́ hàn nínú àwọn ààyè-iṣẹ́ tí o lè fi VPS pamọ́. Fi ID ààyè-iṣẹ́ náà lọ́wọ́lọ́wọ́ bíi location_id látigbá tí o bá kọ́ sáà.

Àwọn ìparí 2 endpoints
Ipa-ọna Ipilẹ /api/v1/locations
GBÀ /api/v1/locations/

Ṣe àkójọ gbogbo àwọn ibi tí a wà

Gba àtòjọ àwọn ààyè-iṣẹ́ datacenter tó lè wa níbí tí o ti lè fi àwọn sáà VPS pamọ́.

Àpẹẹrẹ Ìbéèrè

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);

Àpẹẹrẹ Ìdáhùn

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

Àwọn Ààyè Ìdáhùn

Àwọn Ààyè-iṣẹ́ Irú Àwọn Àkọlé
id integer Àtòjọ-ẹ̀yàn ààyè-iṣẹ́. Lò ní bíi àtòjọ-ẹ̀yàn_àyè-iṣẹ́ láti fi sáà kọ́.
name string Orúkọ ààyè-iṣẹ́ tí a lè kà
country_name string Àwọn ààyè-iṣẹ́ àwọn ààyè-iṣẹ́
country_code string Àwọn àmì-ìwé àwọn ààyè-iṣẹ́ ISO 3166-1 alpha-2, àwọn à
is_active boolean Bó ààyè-iṣẹ́ náà gbá àwọn sáà tuntun

Àwọn Kóòdù Ipò Ìdáhùn

200 Àkójọ àwọn ibi tí a ti rí gbà ní àṣeyọrí
403 Tokénà API tí kò bá jẹ́ tàbí tí kò bá jẹ́, tàbí tokénà náà kò ní ìṣẹ̀dà tí a fẹ́
GBÀ /api/v1/locations/{id}/

Gba ààyè-iṣẹ́ kan

Gba ààyè-iṣẹ́ kan láti inú ID rẹ. Àwọn ìṣàmúlò-ètò ní àwọn ààyè-iṣẹ́ tí a fi pamọ́ síì.

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
}

Ààyè Tí Àwọn Sáà Rẹ̀

Every VPS.org server currently runs in our New Jersey, USA location, which serves customers worldwide over IPv4 and IPv6. Always read the locations endpoint rather than hardcoding an id, so your integration picks up new locations when they are added.