メイン コンテンツをスキップする 補完的コンテンツへスキップ

APIを使ったデータモデルの読み取り

データモデルは名前で取得できます。応答にはそのデータモデルの属性に関する技術情報が含まれているので、データモデルのアップデートも可能です。

この例ではリクエストの送信でTalend API Testerが使われます。

Talend API Testerの詳細は、Talend Cloud API Testerユーザーガイドをご覧ください。

手順

  1. パーソナルアクセストークンがまだない場合は1つ生成します。詳細は、パーソナルアクセストークンを生成をご覧ください。
  2. ブラウザーでTalend API Testerを開きます。
  3. [Repository] (リポジトリー)タブの[Method] (メソッド)ドロップダウンリストで、[Get]を選択します。
  4. https://tds.{region}.cloud.talend.com/schemaservice/api/v1/schemas/org.talend.schema/{dataModelName}というURLを入力します。
    各データセンターのURLのリストは、Talend CloudのリージョンとURLで確認できます。

    {dataModelName}はデータモデルの技術名であり、Talend Cloud Data Stewardshipのデータモデルのリストに表示されている名前ではありません。APIを使ったデータモデルの作成で使われているmy_products_created_via_APIがその一例です。

  5. [Add hearder] (ヘッダーの追加)ボタンをクリックし、[name] (名前)フィールドに Authorizationと、そして[value] (値)フィールドにBearerに続けて空白スペースと自分のトークンを入力します。
  6. [Add header] (ヘッダーの追加)ボタンをクリックし、[name] (名前)フィールドにCookieと入力します。[value] (値)フィールドを空のままにしておきます。
  7. [Send] (送信)をクリックします。

タスクの結果

リクエストが成功したことを表す200 HTTPコードがAPIによって返されます。この応答には、データモデル属性のJSONによる説明が含まれています。例:
{
    "namespace": "org.talend.schema",
    "displayName": "Product (created via API)",
    "name": "my_products_created_via_API",
    "description": "Product catalog available.",
    "version": 1,
    "references": null,
    "creationDate": 1601467434441,
    "lastUpdateDate": 1601467434441,
    "createdBy":{
        "id": "3e2eed7d-c632-40da-822e-9780f2c74842",
        "username": "user@account",
        "firstName": "user",
        "lastName": "name",
        "enabled": true
    },
    "lastUpdatedBy": {
        "id": "3e2eed7d-c632-40da-822e-9780f2c74842",
        "username": "user@account",
        "firstName": "user",
        "lastName": "name",
        "enabled": true
    },
    "fields": [{
        "uuid": "333ca858-5083-4425-bf36-c4fb3c259550",
        "name": "Id",
        "displayName": "Id",
        "path": null,
        "type": "integer",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "fef4318c-b859-45ce-a454-06cd3ded3389",
        "name": "Name",
        "displayName": "Name",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "7fa67525-bd6d-4b69-ad5b-f515911d32a6",
        "name": "Material",
        "displayName": "Material",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "7673756a-73e8-4c4f-b460-86cc27e938e7",
        "name": "Size",
        "displayName": "Size",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "1f358991-9c16-412a-88d4-75b99a3d1748",
        "name": "Price",
        "displayName": "Price",
        "path": null,
        "type": "decimal",
        "description": "",
        "required": true,
        "constraints": [{
            "name": "scaleDecimal",
            "value": "2"
        }],
        "allowedValues": null
    }, {
        "uuid": "c933a4d6-3ce5-4548-99fe-102313ef47e4",
        "name": "Quantity",
        "displayName": "Quantity",
        "path": null,
        "type": "integer",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "dcd1b06f-2545-45f5-a94f-4f8ddbfc35b7",
        "name": "Family",
        "displayName": "Family",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "9bf5f4b2-7454-423d-a2e7-3a41de740927",
        "name": "Packaging",
        "displayName": "Packaging",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "48678877-8401-47d8-93d9-2097fe0df3c0",
        "name": "ProductURL",
        "displayName": "Product URL",
        "path": null,
        "type": "URL",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "737ea048-de9c-414b-9052-904ad8ed316a",
        "name": "productType",
        "displayName": "Type",
        "path": null,
        "type": "text",
        "description": "",
        "required": false,
        "constraints": [],
        "allowedValues": null
    }],
    "referenced": true
}
情報メモ注: 存在しない名前でデータモデルを検索しようとすると、APIによって404 Not Foundというエラーが返されます。この応答には次のようなメッセージが含まれています:
"code":"SCHEMA_ALL_SCHEMA_NOT_FOUND","message":"SCHEMA_NOT_FOUND","context":{"namespace":"org.talend.schema","name":"demo_produc"}}

このページは役に立ちましたか?

このページまたはコンテンツに、タイポ、ステップの省略、技術的エラーなどの問題が見つかった場合は、お知らせください。改善に役立たせていただきます。