VPS.org API

REST APIドキュメント

ロケーションAPI

VPS を配置できる場所をリストします。サーバを作成するときは、場所の id を location_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 をハードコード化する代わりに、常に場所のエンドポイントを読み込み、統合は新しい場所が追加されたときにそれを取得します。