Skip to content
Last updated

REST APIを使用したタグの作成、編集、削除

TD Administratorとして、タグを作成し、カラムにタグを添付し、カラムアクセスを強制するポリシーを作成できます。

タグの作成

特定のポリシーによって決定されるカラムへのアクセスを制御したり、データをより効率的に検索するためにカラムに注釈を付けたりできるタグを作成できます。各カラムに作成できるポリシータグは1つのみです。以下の例では、PIIというポリシータイプのタグを作成する方法を示します。

$ curl -s -H "Content-Type: application/json" -d '{"data":{"attributes":{"name":"PII","humanReadableName":"PII","comment":"Personal Identifiable Information","namespace":"POLICY","color":"POLICY_DEFAULT"}}}' -H "Authorization: TD1 ..." -X POST https://api-data-def-repo.treasuredata.com/v1/annotation-type/custom
  • レスポンスの例
{
  "id": "3213869e-7e13-45fc-99a7-1b039a7333a5",
  "attributes": {
    "name": "PII",
    "humanReadableName": null,
    "comment": "Personal Identifiable Information",
    "version": 1,
    "createdAt": "2022-01-13T19:23:23.588114Z",
    "updatedAt": "2022-01-13T19:23:23.588114Z",
    "color": "POLICY_DEFAULT",
    "namespace": "POLICY"
    },
  "type": "annotation-type"
}

タグの編集または削除

Administratorのみがポリシーを編集または削除できます。Treasure Dataは、ポリシーによって参照されているタグをAdministratorが削除することを防止します。

$ curl -s -H "Content-Type: application/json" -d '{"data":{"attributes":{"color":"PII","comment":"Personal data"}}}' -H "Authorization: TD1 ..." -X PATCH https://api-data-def-repo.treasuredata.com/v1/annotation-type/custom/3213869e-7e13-45fc-99a7-1b039a7333a5
  • レスポンスの例
{
  "id": "3213869e-7e13-45fc-99a7-1b039a7333a5",
  "attributes": {
  "name": "PII",
  "humanReadableName": null,
  "comment": "Personal data",
  "version": 3,
  "createdAt": "2022-01-13T19:23:23.588114Z",
  "updatedAt": "2022-01-13T19:27:59.238233Z",
  "color": "PII",
  "namespace": "POLICY"
  },
  "type": "annotation-type"
}