VPS.org API

Tahirin-kevitra REST API

API momba ny toerana

Mamaritra ireo toerana ahafahanao mametraka VPS. Alefaso amin'ny alalan'ny location_id ny adiresin'ilay toerana rehefa mamorona mpizara iray ianao.

Teboka farany 2 endpoints
Lalana fototra /api/v1/locations
ALAO /api/v1/locations/

Tanisao ny toerana rehetra

Maka ny lisitr'ireo toerana misy ny foibe angon-drakitra izay azonao ampiasaina amin'ny mpizara VPS.

Ohatra amin'ny fangatahana

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

Ohatra amin'ny Valiny

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

Saha Valiny

Field Karazana Fanoritsoritana
id integer Mpamantatra toerana. Ampiasao ho location_id rehefa mamorona mpizara iray.
name string Anaran'ilay toerana azo vakiana
country_name string Ny firenena misy ilay toerana
country_code string Famantarana firenena ISO 3166-1 alpha-2, litera lehibe
is_active boolean Raha mandray mpizara vaovao ilay toerana

Kaody momba ny satan'ny valiny

200 Voaray soa aman-tsara ny lisitry ny toerana
403 Token API tsy misy na tsy mitombina, na tsy manana ny fahazoan-dàlana ilaina ilay token
ALAO /api/v1/locations/{id}/

Handray toerana iray

Maka toerana iray amin'ny alalan'ny ID-ny. Zavatra iray misy toerana iray miaraka amin'ireo sehatr'asa etsy ambony no valin'ny fangatahana.

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
}

Ny toerana andefasana ny mpizarao

Ny mpizara VPS.org tsirairay dia mandeha ao amin'ny toerana misy antsika ao New Jersey, Etazonia amin'izao fotoana izao, izay mandray ny mpanjifa manerana izao tontolo izao amin'ny alalan'ny IPv4 sy IPv6. Vakio foana ny toerana farany fa tsy ny famaritana ny ID, ka ny fampidiranao dia mandray toerana vaovao rehefa ampidirina izy ireo.