アプリケーションプログラミングインターフェースガイド> REST API> TDVサーバーREST API> Schema API
 
Schema(スキーマ)API
スキーマ REST APIは、複数の(公開された)仮想スキーマを作成、変更、または削除する機能を提供します。リソースに対して実行できるオペレーションは次のとおりです。
GET /schema/virtual
PUT /schema/virtual
POST /schema/virtual
DELETE /schema/virtual
DELETE /schema/virtual/{schemaPath}
GET /schema/virtual
このAPIは、仮想スキーマに関する要約情報や詳細情報を取得するために使用されます。
パラメーター:
名前
説明
パラメータータイプ
データタイプ
path
仮想スキーマパス
query
string
summary
仮想スキーマの概要を取得
query
boolean
仮想スキーマ「/services/databases/ publicationDB/sch1」の要約を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/schema/v1/virtual?path=%2Fservices%2Fdatabases%2FpublishedDB%2Fsch1&summary=true" -H "Content-Type:application/json"
仮想スキーマ「/services/databases/publishedDB/sch1」に関する詳細情報を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/schema/v1/virtual?path=%2Fservices%2Fdatabases%2FpublishedDB%2Fsch1" -H "Content-Type:application/json"
PUT /schema/virtual
このAPIは、仮想スキーマを更新するために使用されます。
パラメーター:
なし。
リクエスト本文
値の例-スキーマ
[
“path”: "string",
“annotation”: “string”,
“newPath”: “string”,
“ifNotExists”: true
]
アノテーションを更新し、公開されたスキーマの名前を「/services/databases/publishedDB/sch1から/services/databases/ publicationdDB/sch2」に変更する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"annotation\":\"Edited published schema created using REST api\", \"newPath\":\"/services/databases/publishedDB/sch2\" }]"
アノテーションを更新し、公開されたスキーマ「/services/database/publishedDB/sch2を/services/database/ publicationdDB1/sch2」に再配置する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch2\", \"annotation\":\"Edited published schema created using REST api\", \"newPath\":\"/services/databases/publishedDB1/sch2\" }]"
公開されたスキーマ「/services/databases/ publicationDB/sch1」のアノテーションを設定解除する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"annotation\":\"null\" }]"
POST /schema/virtual
このAPIは、仮想スキーマを作成するために使用されます。
パラメーター:
なし。
リクエスト本文
値の例-スキーマ
[
“path”: "string",
“annotation”: “string”,
“newPath”: “string”,
“ifNotExists”: true
]
仮想スキーマ「/services/databases/ publicationDB/sch1」を作成する例
curl -X POST -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"annotation\":\"This is a published schema created using REST api\" }]"
「ifNotExists」構文を使用して仮想スキーマ「/services/database/ publishedDB/sch1」を作成する例
curl -X POST -u admin:admin "http://localhost:9400/rest/schema/v1/virtual" -H "Content-Type:application/json" -d "[{\"path\":\"/services/databases/publishedDB/sch1\", \"ifNotExists\":true, \"annotation\":\"This is a published schema created using REST api\" }]"
/schema/virtualを削除します
このAPIは、仮想スキーマを削除するために使用されます。
パラメーター:
 
名前
説明
パラメータータイプ
データタイプ
ifExists
リソースが存在するかどうかを示すフラグ
query
boolean
リクエスト本文
値の例-スキーマ
[
"string"
]
仮想スキーマ「/services/databases/publicationdDB/sch1」および「/services/database/ publishedDB/sch2」を削除する例
curl -X DELETE -u admin:admin "http://localhost:9400/rest/ schema/v1/virtual" -H "Content-Type:application/ json" -d "[\"/services/databases/ publishedDB/sch1\", \"/services/databases/ publishedDB/sch2\"]"
「ifExists」を使用したサンプルCURL呼び出し:
curl -X DELETE -u admin:admin "http://localhost:9400/rest/schema/v1/virtual?ifExists=true" -H "Content-Type:application/json" -d "[\"/shared/examples/publishedDB/sch2\"]"
DELETE /schema/virtual/{schemaPath}
このAPIは、パスで指定された仮想スキーマを削除するために使用されます。
パラメーター:
 
名前
説明
パラメータータイプ
データタイプ
schemaPath
スキーマのパス
query
string
ifExists
リソースが存在するかどうかを示すフラグ
query
boolean
仮想スキーマを削除する例
curl -X DELETE -u admin:admin "http://localhost:9400/rest/schema/v1/virtual/{schemaPath}?ifExists=true" -H "Content-Type: application/json"
curl -X DELETE -u admin:admin "http://localhost:9400/rest/schema/v1/virtual/%2Fservices%2Fdatabases%2Fpubdb%2Fschema1?ifExists=true" -H "Content-Type:application/json"