For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/ko/api/latest/reference-tables/create-reference-table.md. A documentation index is available at /llms.txt.
Language
Datadog site

Reference Table 생성

POSThttps://api.datadoghq.com/api/v2/reference-tables/tableshttps://api.us3.datadoghq.com/api/v2/reference-tables/tableshttps://api.us5.datadoghq.com/api/v2/reference-tables/tableshttps://api.datadoghq.eu/api/v2/reference-tables/tableshttps://api.ap1.datadoghq.com/api/v2/reference-tables/tableshttps://api.ap2.datadoghq.com/api/v2/reference-tables/tableshttps://api.uk1.datadoghq.com/api/v2/reference-tables/tableshttps://api.ddog-gov.com/api/v2/reference-tables/tableshttps://api.us2.ddog-gov.com/api/v2/reference-tables/tables

개요

Reference Table을 생성합니다. 데이터는 다음과 같이 두 가지 방법으로 제공할 수 있습니다.

  1. POST /api/v2/reference-tables/upload를 호출하여 업로드 ID를 얻습니다. 그런 다음 요청 본문에서 CSV 데이터(파일 자체가 아님)를 각 URL에 청크 단위로 PUT합니다. 마지막으로, file_metadata의 upload_id를 사용하여 POST 엔드포인트를 호출합니다.
  2. file_metadata에 클라우드 스토리지의 CSV 파일을 가리키는 access_details를 제공합니다.

요청

Body Data (required)

항목
유형
설명
data
object

로컬 파일 또는 클라우드 스토리지에서 새 Reference Table을 생성하기 위한 요청 본문입니다.

응답

Created

A reference table resource containing its full configuration and state.

항목
유형
설명
data
object

The data object containing the reference table configuration and state.

코드 예시

Reference Table 생성
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF
## Create table from cloud storage (S3)

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## default

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Customer reference data synced from S3",
      "file_metadata": {
        "access_details": {
          "aws_detail": {
            "aws_account_id": "924305315327",
            "aws_bucket_name": "my-data-bucket",
            "file_path": "customers.csv"
          }
        },
        "sync_enabled": true
      },
      "schema": {
        "fields": [
          {
            "name": "customer_id",
            "type": "STRING"
          },
          {
            "name": "customer_name",
            "type": "STRING"
          },
          {
            "name": "email",
            "type": "STRING"
          }
        ],
        "primary_keys": [
          "customer_id"
        ]
      },
      "source": "S3",
      "table_name": "customer_reference_data",
      "tags": [
        "team:data-platform"
      ]
    },
    "type": "reference_table"
  }
}
EOF

## Create table from local file upload

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/reference-tables/tables" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "description": "Product catalog uploaded via local file",
      "file_metadata": {
        "upload_id": "00000000-0000-0000-0000-000000000000"
      },
      "schema": {
        "fields": [
          {
            "name": "product_id",
            "type": "STRING"
          },
          {
            "name": "product_name",
            "type": "STRING"
          },
          {
            "name": "price",
            "type": "DOUBLE"
          }
        ],
        "primary_keys": [
          "product_id"
        ]
      },
      "source": "LOCAL_FILE",
      "table_name": "product_catalog",
      "tags": [
        "team:ecommerce"
      ]
    },
    "type": "reference_table"
  }
}
EOF