アプリケーションプログラミングインターフェイスガイド> REST API> TDVサーバーREST API> Datasource API
 
Datasource(データソース)API
データソースAPIは、非公開領域および仮想(公開)データベースで、リレーショナルのファイル区切りのMS Excel(非ODBC)またはMS Excelデータソースを作成、変更、削除、および読み取る機能を提供します。次のオペレーションを実行できます。
GET/datasource
PUT/datasource
POST/datasource
DELETE/datasource
GET/datasource/adapter/definitions
GET/datasource/virtual
PUT/datasource/virtual
POST/datasource/virtual
DELETE/datasource/virtual
DELETE/datasource/virtual/dsName
GET/datasource/virtual/adapter/definitions
GET/datasource
このAPIは、データソースの概要や詳細情報を取得するために使用されます。
パラメーター:
名前
説明
パラメータータイプ
データタイプ
path
データソースパス
query
string
summary
データソースの概要を取得
query
boolean
データソースの概要「/shared/examples/ds1」を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1?path=%2Fshared%2Fexamples%2Fds_orders&summary=true" -H "Content-Type:application/json"
データソース「/shared/examples/ds1」の詳細情報を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1?path=%2Fshared%2Fexamples%2Fds_orders" -H "Content-Type:application/json"
PUT/datasource
このAPIは、データソースを更新するために使用されます。
パラメーター:
なし。
リクエスト本文
値の例-スキーマ
[
{
"parentPath": "string",
"name": "string",
"adapterName": "string",
"nativeProperties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"annotation": "string",
"newPath": "string",
"newName": "string",
"ifNotExists": true
}
]
リレーショナルデータソースの名前を変更して再配置する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared\", \"name\":\"ds1\", \"adapterName\":\"PostgreSQL 9.1\", \"newPath\":\"/shared/examples/dsnew\" }]"
リレーショナルデータソース「/shared/examples/ds1」のアノテーションとデータベース名を更新する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"ds1\", \"adapterName\":\"PostgreSQL 9.1\", \"annotation\":\"Edited annotation of a postgres datasource created using REST api\", \"nativeProperties\":{\"urlDatabaseName\":\"inventory\"} }]"
ファイル区切りのデータソース「/shared/examples/csv_ds」の注釈と区切り文字を更新する例
ファイル区切りデータソースのサンプルCURL呼び出し:
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"csv_ds\", \"adapterName\":\"File-Delimited\", \"annotation\":\"Edited annotation of a csv datasource created using REST api\", \"nativeProperties\":{\"delimiter\":\":\"} }]"
MS Excel(非ODBC)データソース「/shared/examples/excel_ds」の注釈とデータ範囲を更新する例
MS Excel(非ODBC)データソースのサンプルCURL呼び出し:
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"excel_ds\", \"adapterName\":\"Microsoft Excel (non-ODBC)\", \"annotation\":\"Edited annotation of a MS excel datasource created using REST api\", \"nativeProperties\":{\"dataRange\":\"A2\"} }]"
MS Excel(ODBC)データソース「/shared/examples/excel_ds」の注釈とdsnを更新する例
MS Excel(ODBC)データソースのサンプルCURL呼び出し:
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"excel_ds\", \"adapterName\":\"Microsoft Excel\", \"annotation\":\"Edited annotation of a MS excel datasource created using REST api\", \"nativeProperties\":{\"dsn\":\"excelodbc1\"} }]"
api\"、\"nativeProperties\":{\"dataRange\":\"A2\"}}]"
リレーショナルデータソース「/shared/examples/ds1」のアノテーションを設定解除する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"ds1\", \"adapterName\":\"PostgreSQL 9.1\", \"annotation\":\"null\"}]"
POST/datasource
このAPIは、指定されたデータベースアダプター、パス、およびプロパティのデータソースを作成するために使用されます
パラメーター:
なし。
リクエスト本文
値の例-スキーマ
[
{
"parentPath": "string",
"name": "string",
"adapterName": "string",
"nativeProperties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"annotation": "string",
"newPath": "string",
"newName": "string",
"ifNotExists": true
}
]
リレーショナルデータソース「/shared/examples/ds1」を作成する例
サンプルCURL呼び出し
curl -X POST -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"ds1\", \"adapterName\":\"PostgreSQL 9.1\", \"annotation\":\"This is a postgres datasource created using REST api\", \"nativeProperties\":{\"urlIP\":\"localhost\", \"urlPort\":5432, \"urlDatabaseName\":\"orders\", \"login\":\"tutorial\", \"password\":\"password\"} }]"
ファイル区切りのデータソース「/shared/examples/csv_ds」を作成する例
サンプルCURL呼び出し
curl -X POST -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"csv_ds\", \"adapterName\":\"File-Delimited\", \"annotation\":\"This is a csv datasource created using REST api\", \"nativeProperties\":{\"root\":\"/Users/Shared\", \"filters\":\"*.csv\", \"charset\":\"utf-8\"} }]"
MS Excel(非ODBC)データソース「/shared/examples/excel_ds」を作成する例
curl -X POST -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"excel_ds\", \"adapterName\":\"Microsoft Excel (non-ODBC)\", \"annotation\":\"This is a Microsoft excel datasource created using REST api\", \"nativeProperties\":{\"root\":\"/Users/Shared\", \"filters\":\"*.xls\", \"charset\":\"utf-8\"} }]"
MS Excel(ODBC)データソース「/shared/examples/excel_ds」を作成する例
MS Excel(非ODBC)データソースのサンプルCURL呼び出し:
curl -X POST -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"excel_ds\", \"adapterName\":\"Microsoft Excel\", \"annotation\":\"This is a Microsoft excel datasource created using REST api\", \"nativeProperties\":{\"dsn\":\"excelodbc\", \"charset\":\"utf-8\"} }]"
DELETE/datasource
このAPIは、データソースを削除するために使用されます。
パラメーター:
なし
リクエスト本文
値の例-スキーマ
[
"string"
]
データソース「/shared/examples/ds1」を削除する例
curl -X DELETE -u admin:admin "http://localhost:9400/rest/datasource/v1" -H "Content-Type:application/json" -d "[\"/shared/examples/ds1\"]"
GET/datasource/アダプター/定義
このAPIは、データソース属性定義を取得するために使用されます。返される結果のスキーマは、[ADAPTER_NAME、ADAPTER_TYPE、ADAPTER_TYPE_CATEGORY、DEFINITION_NAME、DISPLAY_NAME、DEFINITION_TYPE、REQUIRED、DEFAULT_VALUE、ALLOWED_VALUES、EDITOR_HINT、IS_ADVANCED、DISPLAY_PARENT_NAME、DEPENDENCY_EXPRESSION、UPDATE_RULEです。
パラメーター:
名前
説明
パラメータータイプ
データタイプ
adapterName
アダプターの名前
query
string
「PostgreSQL9.1」のデータソース属性定義を取得する例
サンプルCURL呼び出し
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/adapter/definitions?adapterName=PostgreSQL%209.1" -H "Content-Type:application/json"
「ファイル区切り」のデータソース属性定義を取得する例
サンプルCURL呼び出し
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/adapter/definitions?adapterName=File-Delimited" -H "Content-Type:application/json"
「MicrosoftExcel(非ODBC)」のデータソース属性定義を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/adapter/definitions?adapterName=Microsoft%20Excel%20(non-ODBC)" -H "Content-Type:application/json"
「MicrosoftExcel」のデータソース属性定義を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/adapter/definitions?adapterName=Microsoft%20Excel" -H "Content-Type:application/json"
GET/datasource/仮想
このAPIは、仮想データベースの概要や詳細情報を取得するために使用されます。
パラメーター:
名前
説明
パラメータータイプ
データタイプ
name
仮想データベースの名前
query
string
summary
仮想データベースの概要を取得
query
boolean
仮想データベース「/services/databases/ publishedDB」の概要を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual?name=publishedDB&summary=true" -H "Content-Type:application/json"
仮想データベース「/services/databases/publishedDB」の詳細情報を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/adapter/definitions?adapterName=File-Delimited" -H "Content-Type:application/json"
「MicrosoftExcel(非ODBC)」のデータソース属性定義を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/adapter/definitions?adapterName=Microsoft%20Excel%20(non-ODBC)" -H "Content-Type:application/json"
「MicrosoftExcel」のデータソース属性定義を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual?name=publishedDB" -H "Content-Type:application/json"
PUT/datasource/仮想
このAPIは、仮想データソースを更新するために使用されます。
パラメーター:
なし。
リクエスト本文
値の例-スキーマ
[
{
"parentPath": "string",
"name": "string",
"adapterName": "string",
"nativeProperties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"annotation": "string",
"newPath": "string",
"newName": "string",
"ifNotExists": true
}
]
アノテーションを更新し、公開されたデータソースの名前を「/services/database/publishedDBから/services/database/publishedNew」に変更する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual" -H "Content-Type:application/json" -d "[{\"name\":\"publishedDB\", \"annotation\":\"Edited published datasource created using REST api\", \"newName\":\"publishedNew\" }]"
公開されたデータソース「/services/databases/publishedDB」のアノテーションを設定解除する例
curl -X PUT -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual" -H "Content-Type:application/json" -d "[{\"name\":\"publishedDB\", \"annotation\":\"null\"}]"
POST/datasource/仮想
このAPIは、仮想データソースを作成するために使用されます。
パラメーター:
なし。
リクエスト本文
値の例-スキーマ
[
{
"parentPath": "string"、
"name": "string"、
"adapterName": "string"、
"nativeProperties":{
"additionalProp1":{}、
"additionalProp2":{}、
"additionalProp3":{}
}、
"アノテーション": "string"、
"newPath": "string"、
"newName": "string"、
"ifNotExists":true
}
]
>
仮想データソース「/services/databases/publishedDB」を作成する例
curl -X POST -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual" -H "Content-Type:application/json" -d "[{\"name\":\"ds1\", \"annotation\":\"This is a published datasource created using REST api\" }]"
ifNotExistsを使用したサンプルCURL呼び出し:
curl -X POST -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual" -H "Content-Type:application/json" -d "[{\"name\":\"ds1\", \"ifNotExists\":true,\"annotation\":\"This is a published datasource created using REST api\" }]"
DELETE/datasource/仮想
このAPIは、仮想データソースを削除するために使用されます。
パラメーター:
名前
説明
パラメータータイプ
データタイプ
ifExists
データソースが存在するかどうかを示すFlaf
query
boolean
リクエスト本文
値の例-スキーマ
[
"string"
]
公開されたデータソース「/services/databases/publishedDB」を削除する例
curl -X DELETE -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual" -H "Content-Type:application/json" -d "[\"publishedDB\"]"
「ifExists」を使用したサンプルCURL呼び出し:
curl -X DELETE -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual?ifExists=true" -H "Content-Type:application/json" -d "[\"publishedDB\"]"
DELETE/datasource/virtual/dsName
このAPIは、仮想データベースを削除するために使用されます。
パラメーター:
名前
説明
パラメータータイプ
データタイプ
dsName
データベースの名前
query
string
ifExists
データベースが存在するかどうかを示すフラグ
query
boolean
仮想データベースを削除する例
curl -X DELETE -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual/{dsName}?ifExists=true" -H "Content-Type: application/json"
GET/datasource/仮想/アダプター/定義
このAPIは、データソース属性定義を取得するために使用されます。返される結果のスキーマは、[ADAPTER_NAME、ADAPTER_TYPE、ADAPTER_TYPE_CATEGORY、DEFINITION_NAME、DISPLAY_NAME、DEFINITION_TYPE、REQUIRED、DEFAULT_VALUE、ALLOWED_VALUES、EDITOR_HINT、IS_ADVANCED、DISPLAY_PARENT_NAME、DEPENDENCY_EXPRESSION、UPDATE_RULEです。
パラメーター:
なし。
データソース属性定義を取得する例
curl -X GET -u admin:admin "http://localhost:9400/rest/datasource/v1/virtual/adapter/definitions" -H "Content-Type:application/json"