VPS.org API

Constellation name (optional)

Liggings-API

Lys die liggings waar 'n VPS kan gebruik. Gee aan as ligging_id wanneer u 'n bediener skep.

Eindpunte 2 endpoints
Basispad /api/v1/locations
KRY /api/v1/locations/

Lys alle liggings

Onttrek 'n lys van alle beskikbare datasentrum liggings waar jy VPS bedieners kan gebruik.

Voorbeeldversoek

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

Voorbeeldantwoord

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

Antwoordvelde

Veld Tipe Beskrywing
id integer Liggingidentifiseerder. Gebruik dit as ligging_id wanneer 'n bediener geskep word.
name string Mensleesbare liggingnaam
country_name string Land waar die ligging is
country_code string ISO 3166-1 alfa-2 land kode, hoofletters
is_active boolean Of die ligging nuwe bedieners aanvaar

Reaksiestatuskodes

200 Liggingslys suksesvol opgehaal
403 Ontbrekende of ongeldige API-bewys, of die teken het nie die nodige toestemming nie
KRY /api/v1/locations/{id}/

Kry 'n ligging

Onttrek 'n enkele ligging deur sy ID. Die reaksie is een ligging voorwerp met die velde hierbo.

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
}

Waar jou bediener loop

Elke VPS.org bediener loop tans in ons omgewing in New Jersey, USA, wat kliënte regoor die wêreld oor IPv4 en IPv6 bedien. Lees altyd die puntepunt in plaas van om 'n ID hard te druk, en daarom tel jou integrasie nuwe plekke op wanneer dit bygevoeg word.