VPS.org API

Litokomane tsa REST API

API ea Libaka

E bonts'a libaka tseo u ka li sebelisang ho VPS. E fetisa id ea sebaka e le location_id ha u theha setsi.

Mafelo a ho Qetela 2 endpoints
Tsela ea Motheo /api/v1/locations
FUMANA /api/v1/locations/

Thathamisa Libaka Tsohle

Fumana lethathamo la libaka tsohle tse fumanehang moo u ka sebelisang li-server tsa VPS.

Kopo ea Mohlala

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

Karabo ea Mohlala

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

Masimo a Karabo

Setereke Mofuta Bophara
id integer Mokhatlo oa sebaka. E sebelise e le location_id ha o theha sebatli.
name string Lebitso la sebaka se ka balaoang ke motho
country_name string Lefatše moo sebaka se leng teng
country_code string ISO 3166-1 alpha-2 country code, uppercase
is_active boolean Na sebaka sena se tla amohela liserver tse ncha

Likhoutu tsa Boemo ba Karabelo

200 Lethathamo la libaka le fumanoe ka katleho
403 Token ea API e sa nepahalang kapa e sa fumaneheng, kapa token e na le litokelo tse hlokahalang
FUMANA /api/v1/locations/{id}/

Fumana sebaka

Fumana sebaka se le seng ka id ea sona. Bopaki ke ntho e le 'ngoe ea sebaka le libaka tse ka holimo.

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
}

Ha li-servers tsa hau li sebetsa

Kamehla VPS.org server kajeno e tsamaea ka New Jersey rona, USA sebaka, eo e fanang ka bareki ka ho fetisisa lefatšeng ka bophara ka IPv4 le IPv6. Kamehla bala libakeng tse ka morao ho feta hardcoding id, ka hona ho kopanngoa hao e nka libakeng tse ncha ha ba etsoa.