VPS.org API

REST API ලේඛන

ස්ථාන API

ඔබ VPS යෙදවිය හැකි ස්ථාන ලැයිස්තුගත කරන්න. ඔබ සේවාදායකයක් නිර්මාණය කරන විට location_id ලෙස ස්ථානයේ id ක් රියාත්මක කරන්න.

අන්ත ලක්ෂ්‍ය 2 endpoints
පාදක මාර්ගය /api/v1/locations
ලබා ගන්න /api/v1/locations/

සියලුම ස්ථාන ලැයිස්තුගත කරන්න

ඔබ VPS සේවාදායක යෙදවිය හැකි සියලුම දත්ත මධ්යස්ථාන ස්ථාන ලැයිස්තුව ලබා ගන්න.

උදාහරණ ඉල්ලීම

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

උදාහරණ ප්‍රතිචාරය

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

ප්‍රතිචාර ක්ෂේත්‍ර

ක්ෂේත්‍රය වර්ගය විස්තරය
id integer ස්ථානය හඳුනාගැනීම. සේවාදායකයක් නිර්මාණය කරන විට location_id ලෙස එය භාවිතා කරන්න.
name string මිනිසා කියවිය හැකි පිහිටුම නාමය
country_name string පිහිටුම පිහිටා ඇති රට
country_code string ISO 3166-1 alpha-2 රටේ කේතය, විශාල අකුරු
is_active boolean පිහිටුම නව සේවාදායක පිළිගන්නේද නැද්ද යන්න

ප්‍රතිචාර තත්ව කේත

200 ස්ථාන ලැයිස්තුව සාර්ථකව ලබා ගන්නා ලදී.
403 අතුරුදන් හෝ වලංගු API ටොකන්, හෝ ටොකන් අවශ්ය අවසර නොමැත
ලබා ගන්න /api/v1/locations/{id}/

පිහිටුම ලබාගන්න

එහි id විසින් තනි ස්ථානයක් ලබා ගන්න. ප්රතිචාරය ඉහත ක්ෂේත්ර සමග එක් ස්ථානයක් වස්තුව වේ.

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
}

ඔබේ සේවාදායකයන් ධාවනය වන ස්ථානය

සෑම VPS.org සේවාදායකය දැනට අපගේ නිව් ජර්සි ධාවනය, ඇමරිකා එක්සත් ජනපදයේ ස්ථානය, IPv4 සහ IPv6 ක්රමය හරහා ලොව පුරා පාරිභෝගික සේවා කරන. සෑම විටම id hardcoding වෙනුවට ස්ථාන අවසන් ස්ථානය කියවන්න, ඔවුන් එකතු කරන විට ඔබේ ඒකාබද්ධ නව ස්ථාන රැගෙන ඒම සඳහා.