Cloud Databases API
第2世代
Cloud Databases API は、通常、操作を行うために リソースコントローラー API を利用しています。 このAPIドキュメントを参考にして、データサービスの操作を行ってください。
認証
APIへのアクセスには、ヘッダー「 Authorization: Bearer <token> 」を使用して、トークン認証が行われます。 トークンはIAMによって発行された ものでなければなりません。 IAM API キーをトークンとして直接送信することも、 その API キーを使用して IAM ベアラートークンを生成することも できます。
各メソッドを呼び出すには、必要なIAMアクションを含む ロールが割り当てられている 必要があります。 各メソッドは、関連付けられているアクションをリストします。 IAM アクションと、役割にマップする方法について詳しくは、IBM Cloud® に関するアクセス権限の管理を参照してください。
エラー処理
このAPIでは、メソッドが正常に完了したかどうかを示すために、標準の HTTP レスポンスコードを使用しています。 200 のレスポンスは、常に成功を示します。 4xx 形式のレスポンスは、何らかの失敗を示しており、 500 形式のレスポンスは通常、システム内部のエラーを示しています。 これらの応答のいずれにも、より詳細なエラー情報を含むJSON形式の本文が添付されている場合があります。
イベント・トラッキング
アカウント内のAPIのアクティビティは、 IBM Cloud® Activity Tracker サービスを使用することで、アカウント内のAPIのアクティビティを監視できます。 APIメソッドが呼び出されるたびにイベントが発生し、そのイベントは Activity Tracker 内で追跡および監査することができます。 各メソッドごとに、具体的なイベントの種類が記載されています。
デプロイメントIDとCRN
デプロイメント ID は、Cloud Data Services プラットフォーム上の CRN です。 CRN を使用する際は、CRN 値にスラッシュ (/) %2F が含まれている可能性があるため、 URL でエンコードすることを忘れないでください。
例:次のCRN
crn:v1:bluemix:public:databases-for-redis:us-south:a/274074dce64e9c423ffc238516c755e1:29caf0e7-120f-4da8-9551-3abf57ebcfc7::
URL でエンコードすると、次のようになります。
crn:v1:bluemix:public:databases-for-redis:us-south:a%2F274074dce64e9c423ffc238516c755e1:29caf0e7-120f-4da8-9551-3abf57ebcfc7::
ページネーション
現在、ページネーションされたデータを返すエンドポイントはありません。
速度制限
現在、レート制限を実装しているエンドポイントはありません。
方法
デプロイ済みの製品をすべて一覧表示する
デプロイ済みのすべてのクラウドサービスのリストを返します。
GET /v2/resource_instances
要求例:
curl -X GET https://resource-controller.cloud.ibm.com/v2/resource_instances -H "Authorization: Bearer <IAM token>"
応答の例:
{
"rows_count": 100,
"next_url": "/v2/resource_instances?start=<token>",
"resources": [
{
"id": "crn:v1:bluemix:public:databases-for-redis:eu-de:a/40ddc34a953a8c02f10987b59085b60e:07d523b1-6eea-4263-bd03-c17edf355e0b::",
"guid": "07d523b1-6eea-4263-bd03-c17edf355e0b",
"url": "/v2/resource_instances/07d523b1-6eea-4263-bd03-c17edf355e0b",
"created_at": "2026-07-17T06:41:51.267012883Z",
"updated_at": "2026-07-17T06:42:11.22949657Z",
"deleted_at": null,
"created_by": "Id-270000000X",
"updated_by": "",
"deleted_by": "",
"scheduled_reclaim_at": null,
"restored_at": null,
"scheduled_reclaim_by": "",
"restored_by": "",
"name": "test-redis-gen2",
"region_id": "eu-de",
"account_id": "40ddc34a953a8c02f10987b59085b60e",
"reseller_channel_id": "",
"resource_plan_id": "databases-for-redis-gen2-standard",
"resource_group_id": "eb922ba0717f47589ca26d202c5cc915",
"resource_group_crn": "crn:v1:bluemix:public:resource-controller::a/40ddc34a953a8c02f10987b59085b60e::resource-group:eb922ba0717f47589ca26d202c5cc915",
"target_crn": "crn:v1:bluemix:public:globalcatalog::::deployment:databases-for-redis-standard-gen2%3Aeu-de",
"parameters": {
"dataservices": {
"redis": {
"host_flavor": "bxf.4x16",
"members": 2,
"storage_gb": 15,
"version": "8.2"
}
}
},
"allow_cleanup": false,
"crn": "crn:v1:bluemix:public:databases-for-redis:eu-de:a/40ddc34a953a8c02f10987b59085b60e:07d523b1-6eea-4263-bd03-c17edf355e0b::",
"state": "provisioning",
"type": "service_instance",
"sub_type": "Public",
"resource_id": "databases-for-redis",
"dashboard_url": null,
"last_operation": {
"type": "create",
"state": "in progress",
"async": true,
"description": "Provision in progress",
"cancelable": true,
"poll": true
},
"resource_keys_url": "/v2/resource_instances/07d523b1-6eea-4263-bd03-c17edf355e0b/resource_keys",
"plan_history": [
{
"resource_plan_id": "databases-for-redis-gen2-standard",
"start_date": "2026-07-17T06:41:51.267012883Z",
"requestor_id": "Id-270000000X"
}
],
"migrated": false,
"controlled_by": "",
"locked": false,
"onetime_credentials": false
}
]
}
追加のリソースオブジェクトは、 resources 配列内に返されます。 next_url トークンを使用して、検索結果の次のページを取得します。
デプロイ情報を取得する
デプロイメントに関連付けられている全データを取得します。 このデータには、ID、名前、データベースの種類、およびバージョンが含まれています。
GET /v2/resource_instances/{id}
要求例:
curl -X GET https://resource-controller.cloud.ibm.com/v2/resource_instances/95004d03-9fec-443b-9f6e-083f2b25e73a -H "Authorization: Bearer <IAM token>" \
応答の例:
{
"id": "crn:v1:bluemix:public:databases-for-postgresql:us-east:a/23b09aee04da4545b6e32805fa93249d:95004d03-9fec-443b-9f6e-083f2b25e73a::",
"guid": "95004d03-9fec-443b-9f6e-083f2b25e73a",
"url": "/v2/resource_instances/95004d03-9fec-443b-9f6e-083f2b25e73a",
"created_at": "2026-07-02T14:04:29.613949688Z",
"updated_at": "2026-07-02T14:15:54.226535327Z",
"deleted_at": null,
"created_by": "Id-4700030B2K",
"updated_by": "",
"deleted_by": "",
"scheduled_reclaim_at": null,
"restored_at": null,
"scheduled_reclaim_by": "",
"restored_by": "",
"name": "Databases for PostgreSQL-3b",
"region_id": "us-east",
"account_id": "23b09aee04da4545b6e32805fa93249d",
"reseller_channel_id": "",
"resource_plan_id": "databases-for-postgresql-gen2-standard",
"resource_group_id": "c21a4e8564c14d1aab2a9a8b441904eb",
"resource_group_crn": "crn:v1:bluemix:public:resource-controller::a/23b09aee04da4545b6e32805fa93249d::resource-group:c21a4e8564c14d1aab2a9a8b441904eb",
"target_crn": "crn:v1:bluemix:public:globalcatalog::::deployment:databases-for-postgresql-standard-gen2%3Aus-east",
"parameters": {
"dataservices": {
"postgresql": {
"host_flavor": "bx3d.4x20",
"members": 2,
"storage_gb": 10,
"version": "18"
}
}
},
"allow_cleanup": false,
"crn": "crn:v1:bluemix:public:databases-for-postgresql:us-east:a/23b09aee04da4545b6e32805fa93249d:95004d03-9fec-443b-9f6e-083f2b25e73a::",
"state": "active",
"type": "service_instance",
"sub_type": "Public",
"resource_id": "databases-for-postgresql",
"dashboard_url": null,
"last_operation": {
"type": "create",
"state": "succeeded",
"async": true,
"description": "Provision completed successfully",
"cancelable": true,
"poll": true
},
"resource_keys_url": "/v2/resource_instances/95004d03-9fec-443b-9f6e-083f2b25e73a/resource_keys",
"plan_history": [
{
"resource_plan_id": "databases-for-postgresql-gen2-standard",
"start_date": "2026-07-02T14:04:29.613949688Z",
"requestor_id": "Id-4700030B2K"
}
],
"migrated": false,
"extensions": {
"dataservices": {
"$schema": {
"version": "1.0.0"
},
"connection": {
"cli": {
"arguments": [
"host=95004d03-9fec-443b-9f6e-083f2b25e73a.private.uhp.postgresql.us-east.dataservices.appdomain.cloud port=5432 dbname=postgres user=$PGUSER password=$PGPASSWORD sslmode=verify-full"
],
"bin": "psql",
"composed": [
"PGUSER=$PGUSER PGPASSWORD=$PGPASSWORD PGSSLMODE=verify-full PGSSLROOTCERT=system psql 'host=95004d03-9fec-443b-9f6e-083f2b25e73a.private.uhp.postgresql.us-east.dataservices.appdomain.cloud port=5432 dbname=postgres'"
],
"environment": {
"PGPASSWORD": "$PGPASSWORD",
"PGSSLMODE": "verify-full",
"PGSSLROOTCERT": "system",
"PGUSER": "$PGUSER"
},
"type": "cli"
},
"postgres": {
"authentication": {
"method": "direct",
"password": "$PGPASSWORD",
"username": "$PGUSER"
},
"composed": [
"postgres://$PGUSER:$PGPASSWORD@95004d03-9fec-443b-9f6e-083f2b25e73a.private.uhp.postgresql.us-east.dataservices.appdomain.cloud:5432/postgres?sslmode=verify-full"
],
"database": "postgres",
"hosts": [
{
"hostname": "95004d03-9fec-443b-9f6e-083f2b25e73a.private.uhp.postgresql.us-east.dataservices.appdomain.cloud",
"port": 5432
}
],
"path": "/postgres",
"port": 5432,
"query_options": {
"sslmode": "verify-full"
},
"scheme": "postgres",
"type": "uri"
}
},
"postgresql": {
"configuration": {
"max_connections": 115
},
"cpu_count": 4,
"host_flavor": "bx3d.4x20",
"members": 2,
"memory_gb": 20,
"storage_gb": 10,
"version": "18"
}
},
"virtual_private_endpoints": {
"dns_domain": "95004d03-9fec-443b-9f6e-083f2b25e73a.private.uhp.postgresql.us-east.dataservices.appdomain.cloud",
"dns_hosts": [
"",
"*"
],
"endpoints": [
{
"ip_address": "10.51.217.34",
"zone": "us-east-1"
},
{
"ip_address": "10.51.219.57",
"zone": "us-east-2"
},
{
"ip_address": "10.51.221.12",
"zone": "us-east-3"
}
],
"origin_type": "vpc",
"ports": [
{
"port_max": 5432,
"port_min": 5432
}
]
}
},
"controlled_by": "",
"locked": false,
"onetime_credentials": false
}
APIのレスポンスからは、以下の情報を取得できます:
last_operationオブジェクト - 最後に実行したタスクを表示します。connectionobject - 製品の接続情報を表示します。- 製品固有の情報は、製品オブジェクトの下に表示されます(例:
postgresql)。
データベースのプロビジョニング方法
POST /v2/resource_instances
要求例:
curl -X POST https://resource-controller.cloud.ibm.com/v2/resource_instances \
-H "Authorization: Bearer <IAM token>" \
-H 'Content-Type: application/json' \
-d '{
"name": "my-instance",
"target": "ca-mon",
"resource_group": "5c49eabc-f5e8-5881-a37e-2d100a33b3df",
"resource_plan_id": "databases-for-postgresql-gen2-standard",
"parameters": {
"dataservices": {
"postgresql": {
"storage_gb": 10,
"members": 2,
"host_flavor": "b3c.8x32.encrypted",
"version": "18"
},
"encryption": {
"disk": "crn:v1..."
},
"$schema": {
"version": "1.0.0"
}
}
}
}'
入力パラメーター
name(文字列)- インスタンスの名前。target(文字列)- デプロイ先のリージョン(例:us-south、eu-de)。resource_group(文字列)- リソースグループのID。resource_plan_id(文字列)- プラン ID(例:databases-for-postgresql-gen2-standard)。parameters(オブジェクト)dataservices(オブジェクト)<service>(オブジェクト)- サービス名のキー(例:postgresql、mysql)。storage_gb(整数)- ストレージ容量(GB単位)。members(整数)- メンバーの数。host_flavor(文字列)- ホスト・フレーバー ID(例:b3c.8x32.encrypted)。version(文字列)- データベースのバージョン(例:"18")。
encryption(オブジェクト、省略可)- ディスク暗号化の設定。disk(文字列)- ディスク暗号化用の「 Key Protect 」キーのCRN。
$schema(オブジェクト)- スキーマのメタデータ。version(文字列)- スキーマのバージョン。"1.0.0"でなければなりません。
データベースのスケーリング方法
PATCH /v2/resource_instances/{id}
要求例:
curl -X PATCH https://resource-controller.cloud.ibm.com/v2/resource_instances/ed9d2c9b-444b-421d-bbc0-503ca8dd3036 \
-H "Authorization: Bearer <IAM token>" \
-H 'Content-Type: application/json' \
-d '{
"parameters": {
"dataservices": {
"postgresql": {
"storage_gb": 12,
"members": 2,
"host_flavor": "bxf.4x16"
}
}
}
}'
入力パラメーター
parameters(オブジェクト)dataservices(オブジェクト)<service>(オブジェクト)- サービス名のキー(例:postgresql、mysql)。storage_gb(整数)- ストレージ容量(GB単位)。members(整数)- メンバーの数。host_flavor(文字列)- ホスト・フレーバー ID(例:bxf.4x16)。