VPS.org API

Uxwebhu lwe-REST API

I-API yeendawo

Uluhlu lweendawo apho ungasebenzisa khona i-VPS. Yidlulise indawo ye-id njenge-location_id xa udala iseva.

Iindawo zokugqibela 2 endpoints
Indlela Esisiseko /api/v1/locations
FUMANA /api/v1/locations/

Dwelisa Zonke Iindawo

Fumana uluhlu lweendawo zonke ezifumanekayo zedatacenter apho ungasebenzisa khona iiseva ze VPS.

Isicelo somzekelo

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

Impendulo yoMzekelo

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

IiNdawo zeMpendulo

Iindawo Uhlobo Inkcazelo
id integer Isichazi-ndawo. Sebenzisa njenge-location_id xa usenza iseva.
name string Igama lendawo efundekayo ngumntu
country_name string Ilizwe apho indawo ibekwe khona
country_code string ISO 3166-1 alpha-2 ikhowudi yelizwe, uphawu olukhulu
is_active boolean Nokuba ngaba indawo iyamkela na iiseva ezintsha

Iikhowudi zeMeko yokuphendula

200 Uluhlu lweendawo olufunyenwe ngempumelelo
403 I-API token elahlekile okanye engasebenziyo, okanye i-token ayinazimvumelwano ezifunekayo
FUMANA /api/v1/locations/{id}/

Fumana Indawo

Ifumana indawo enye nge id yayo. Impendulo yindawo enye yenjongo enemihlaba ephezulu.

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
}

Indawo apho iSeva yakho iqhuba khona

Zonke i VPS.org iseva ngoku iqhuba kwi New Jersey yethu, i USA indawo, encedisa abathengi jikelele kwi IPv4 ne IPv6. Soloko ufunda iindawo eziphezu kwendlela yesiqhelo kunokuba ucofe i id, ngoko udityaniswa kwakho kuthatha iindawo ezintsha xa zidityanisiwe.