API式 - Cloud

Talend Cloud Data Inventoryユーザーガイド

Version
Cloud
Language
日本語
Product
Talend Cloud
Module
Talend Data Inventory
Content
データガバナンス
データクオリティとプレパレーション > データの充実化
データクオリティとプレパレーション > データの識別
データクオリティとプレパレーション > データセットの管理
管理と監視 > 接続の管理
Last publication date
2024-02-28
サポートされているOData式を使って、リクエストを調整し、データセットから特定のデータを取得します。 詳細は、ODataドキュメンテーションをご覧ください。

サポートされているOData式

具体的なリクエストを作成する場合は、次の式パターン使います。

注: ODataリクエストでサポートされていないオプションを使うと、501 Not Implementedというエラーが発生します。
  • url/$metadata
  • url/entity_set_name
  • url/entity_set_name(primary_key_value)
  • url/entity_set_name(primary_key_value)/column_name
  • url/entity_set_name(primary_key_value)/column_name/$value
  • url/entity_set_name?$top=n
  • url/entity_set_name?$skip=n
  • url/entity_set_name?$skip=n&$top=n
  • url/entity_set_name?$select=column_name
  • url/entity_set_name?$orderby=column_name asc|desc
  • url/entity_set_name?$filter=column_name eq 'value'
  • url/entity_set_name?$filter=contains(column_name, 'value')

リクエストの例

以下のテーブルでは、APIに送信できるリクエストの例がいくつか示されます。この例では、customersという名前のエンティティセット用にAPIは作成されており、生成されるAPIパスはcustomers-api-2PZPTBです。データセットにはcustomer_ageidcustomer_namecustomer_citycustomer_streetという名前のカラムが含まれています。その中から、idというカラムはプライマリキーとして使用されます。
リクエストとそのレスポンスのパターン例
パターン 説明
url/entity_set_name エンティティセットでデータをすべて取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers

レスポンス:

{
	"@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
	"value": [
		{
			"customer_age": "36",
			"id": "g9wjC",
			"customer_name": "Franklin Washington",
			"customer_city": "Olympia",
			"customer_street": "North Erringer Road"
		},
		{
			"customer_age": "31",
			"id": "DNOFp",
			"customer_name": "Theodore Ford",
			"customer_city": "Boise",
			"customer_street": "Lawrenceville Suwanee"
		},
		{
			"customer_age": "41",
			"id": "IRvgp",
			"customer_name": "Gerald Cleveland",
			"customer_city": "Atlanta",
			"customer_street": "Steele Lane"
		},
		{
			"customer_age": "19",
			"id": "V7o2h",
			"customer_name": "Benjamin Adams",
			"customer_city": "Little Rock",
			"customer_street": "Castillo Drive"
		},
		{
			"customer_age": "56",
			"id": "LwvLC",
			"customer_name": "Theodore Hayes",
			"customer_city": "Saint Paul",
			"customer_street": "Carpinteria South"
		},
		{
			"customer_age": "22",
			"id": "2oWSU",
			"customer_name": "Harry Roosevelt",
			"customer_city": "Bismarck",
			"customer_street": "East Calle Primera"
		},
		{
			"customer_age": "68",
			"id": "tnXgw",
			"customer_name": "Rutherford Fillmore",
			"customer_city": "Cheyenne",
			"customer_street": "Jean de la Fontaine"
		}
	]
}
url/$metadata エンティティセットのメタデータを取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata

レスポンス:

<?xml version="1.0" encoding="UTF-8" ?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
    <edmx:DataServices>
        <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="customers-api-2PZPTB">
            <EntityType Name="customersItem">
                <Key>
                    <PropertyRef Name="id"/>
                </Key>
                <Property Name="customer_age" Type="Edm.String"/>
                <Property Name="id" Type="Edm.String"/>
                <Property Name="customer_name" Type="Edm.String"/>
                <Property Name="customer_city" Type="Edm.String"/>
                <Property Name="customer_street" Type="Edm.String"/>
            </EntityType>
            <EntityContainer Name="customers">
                <EntitySet Name="customers" EntityType="customers-api-2PZPTB.customersItem"/>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

url/entity_set_name(primary_key_value) プライマリキー値を使って特定のエンティティを取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers('g9wjC')
レスポンス:
{
    "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
    "customer_age": "36",
    "id": "g9wjC",
    "customer_name": "Franklin Washington",
    "customer_city": "Olympia",
    "customer_street": "North Erringer Road"
}
url/entity_set_name(primary_key_value)/column_name 特定のエンティティに対してカラムを1つ取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers('g9wjC')/customer_name

レスポンス:

{
    "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers/customer_name",
    "value": "Franklin Washington"
}
url/entity_set_name(primary_key_value)/column_name/$value 特定のエンティティに対してカラムの未加工の値を取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers('g9wjC')/customer_city/$value

レスポンス:

Olympia
url/entity_set_name?$top=n エンティティの制限された数を取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$top=2

レスポンス:

{
    "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
    "value": [
        {
            "customer_age": "36",
            "id": "g9wjC",
            "customer_name": "Franklin Washington",
            "customer_city": "Olympia",
            "customer_street": "North Erringer Road"
        },
        {
            "customer_age": "31",
            "id": "DNOFp",
            "customer_name": "Theodore Ford",
            "customer_city": "Boise",
            "customer_street": "Lawrenceville Suwanee"
        }
    ]
}
url/entity_set_name?$skip=n 最初のnエンティティをスキップして、エンティティのコレクションを取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$skip=5

レスポンス:

{
  "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
  "value":[
    {
      "customer_age": "22",
      "id": "2oWSU",
      "customer_name": "Harry Roosevelt",
      "customer_city": "Bismarck",
      "customer_street": "East Calle Primera"
    },
    {
      "customer_age": "68",
      "id": "tnXgw",
      "customer_name": "Rutherford Fillmore",
      "customer_city": "Cheyenne",
      "customer_street": "Jean de la Fontaine"
    },
    {
      "customer_age": "40",
      "id": "QcX7L",
      "customer_name": "Warren Adams",
      "customer_city": "Columbus",
      "customer_street": "North Broadway Street"
    }
  ]
}
url/entity_set_name?$skip=n&$top=n ページネーションを作成して、コレクションからエンティティの特定のページを取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$skip=5&$top=2

レスポンス:

{
    "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
    "value": [
        {
            "customer_age": "22",
            "id": "2oWSU",
            "customer_name": "Harry Roosevelt",
            "customer_city": "Bismarck",
            "customer_street": "East Calle Primera"
        },
        {
            "customer_age": "68",
            "id": "tnXgw",
            "customer_name": "Rutherford Fillmore",
            "customer_city": "Cheyenne",
            "customer_street": "Jean de la Fontaine"
        }
    ]
}
url/entity_set_name?$select=column_name 一部のエンティティのみを取得します。
注: プライマリキーとして使用されるカラムは常に含まれています。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$select=customer_city,customer_street

レスポンス:

{
    "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
    "value": [
        {
            "@odata.id": "customers('g9wjC')",
            "id": "g9wjC",
            "customer_city": "Olympia",
            "customer_street": "North Erringer Road"
        },
        {
            "@odata.id": "customers('DNOFp')",
            "id": "DNOFp",
            "customer_city": "Boise",
            "customer_street": "Lawrenceville Suwanee"
        },
        {
            "@odata.id": "customers('IRvgp')",
            "id": "IRvgp",
            "customer_city": "Atlanta",
            "customer_street": "Steele Lane"
        }
    ]
}
url/entity_set_name?$orderby=column_name asc|desc 属性を1つ以上使って、エンティティのコレクションを特定の順に取得します。このオプションの可能な値はascおよびdescです。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$orderby=customer_age desc

レスポンス:

{
    "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
    "value": [
        {
            "customer_age": "78",
            "id": "2lxMe",
            "customer_name": "Thomas Johnson",
            "customer_city": "Charleston",
            "customer_street": "Redwood Highway"
        },
        {
            "customer_age": "75",
            "id": "EK0fU",
            "customer_name": "Benjamin Jefferson",
            "customer_city": "Austin",
            "customer_street": "Monroe Street"
        },
        {
            "customer_age": "70",
            "id": "3Wmih",
            "customer_name": "Grover Carter",
            "customer_city": "Dover",
            "customer_street": "Redwood Highway"
        }
    ]
}
url/entity_set_name?$filter=column_name eq 'value' フィルターに対応するエンティティのコレクションを取得します。

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$filter=customer_city eq 'Olympia'

レスポンス:

{
  "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
  "value":[
    {
      "customer_age": "36",
      "id": "g9wjC",
      "customer_name": "Franklin Washington",
      "customer_city": "Olympia",
      "customer_street": "North Erringer Road"
    },
    {
      "customer_age": "68",
      "id": "EVFMD",
      "customer_name": "Ronald Van Buren",
      "customer_city": "Olympia",
      "customer_street": "Bayshore Freeway"
    }
  ]
}
注: APIを呼び出すツールによっては、スペースがプラス記号( + )でエンコードされている場合にエラーが発生する場合があります。 この問題を回避するには、パーセントエンコーディングでスペースが%20としてエンコードされていることを確認します。
url/entity_set_name?$filter=contains(column_name, 'value') column_nameに特定の'value'が含まれているフィルターに対応するエンティティのコレクションを取得

リクエスト:

https://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/customers?$filter=contains(customer_name, 'Van')

レスポンス:

{
  "@odata.context": "http://company-talend-com.eu.talend-dataset.com/apis/customers-api-2PZPTB/$metadata#customers",
  "value":[
    {
      "customer_age": "68",
      "id": "EVFMD",
      "customer_name": "Ronald Van Buren",
      "customer_city": "Olympia",
      "customer_street": "Bayshore Freeway"
    }
  ]
}