Flow Service APIを使用してデータテーブルを探索する
このチュートリアルでは、Flow Service APIを使用して、データテーブルの構造と内容を確認およびプレビューする方法について説明します。
はじめに
このガイドは、Adobe Experience Platform の次のコンポーネントを実際に利用および理解しているユーザーを対象としています。
Experience Platform APIの使用
Experience Platform APIの呼び出しを正常に行う方法について詳しくは、Experience Platform APIの概要に関するガイドを参照してください。
データテーブルの探索
ソースのベース接続IDを指定しながらFlow Service APIにGET リクエストを実行すると、データテーブルの構造に関する情報を取得できます。
API 形式
GET /connections/{BASE_CONNECTION_ID}/explore?objectType=root
{BASE_CONNECTION_ID}リクエスト
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/connections/5e73e5a2-dc36-45a8-9f16-93c7a43af318/explore?objectType=root' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答
応答が成功すると、ソースからテーブルの配列が返されます。 Experience Platformに取り込むテーブルを見つけ、そのpath プロパティをメモします。このプロパティは、次の手順で構造を調べる必要があります。
[
{
"type": "table",
"name": "ACME Spring Campaign",
"path": "acmeSpringCampaign",
"canPreview": true,
"canFetchSchema": true
},
{
"type": "table",
"name": "ACME Summer Campaign",
"path": "acmeSummerCampaign",
"canPreview": true,
"canFetchSchema": true
}
]
テーブルの構造を調べる
データテーブルの内容を調べるには、テーブルのパスをクエリパラメーターとして指定しながら、Flow Service APIに対してGET リクエストを実行します。
API 形式
GET /connections/{BASE_CONNECTION_ID}/explore?objectType=table&object={TABLE_PATH}
{BASE_CONNECTION_ID}{TABLE_PATH}リクエスト
curl -X GET \
'https://platform.adobe.io/data/foundation/flowservice/connections/5e73e5a2-dc36-45a8-9f16-93c7a43af318/explore?objectType=table&object=acmeSpringCampaign' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答
応答が成功すると、指定したテーブルの内容と構造に関する情報が返されます。 各テーブルの列に関する詳細は、columns配列の要素内にあります。
{
"format": "flat",
"schema": {
"columns": [
{
"name": "TestID",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "Name",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "Datefield",
"type": "string",
"meta:xdmType": "date-time",
"xdm": {
"type": "string",
"format": "date-time"
}
},
{
"name": "complaint_type",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "complaint_description",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "status",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "status_change_date",
"type": "string",
"meta:xdmType": "date-time",
"xdm": {
"type": "string",
"format": "date-time"
}
},
{
"name": "city",
"type": "string",
"xdm": {
"type": "string"
}
},
{
"name": "Datefield2",
"type": "string",
"meta:xdmType": "date-time",
"xdm": {
"type": "string",
"format": "date-time"
}
}
]
}
}
次の手順
このチュートリアルでは、データテーブルの構造と内容に関する情報を収集しました。 さらに、Experience Platformに取り込むテーブルへのパスを取得しました。 この情報を使用して、ソース接続とデータフローを作成し、データをExperience Platformに取り込むことができます。 Flow Service APIを使用してソース接続とデータフローを作成する方法について詳しくは、次のチュートリアルを参照してください。