To replace the current TD API key with a new TD API key, follow this procedure. This allows you to build your data models without needing to re-create your existing data models. Use the following REST API request for TD API KEY rotation in your data model.
curl -i -X PUT 'https://API_ENDPOINT/reporting/datamodels/YOUR_DATAMODEL_OID' \
--header 'Content-Type: application/json' \
--header "Authorization: TD1 YOUR_TD_APIKEY" \
--data '{
"datamodel": {
"apikey": "YOUR_TD_APIKEY"
}
}' You’ll need to update the following three paramaters to execute.
API_ENDPOINT: Refers to your Treasure Data region.- US: api.treasuredata.com
- EU01: api.eu01.treasuredata.com
- Korea: api.ap02.treasuredata.com
- Tokyo: api.treasuredata.co.jp To confirm your Treasure Data region, see https://api-docs.treasuredata.com/en/overview/aboutendpoints/#treasure-data-api-baseurls.
YOUR_DATAMODEL_OID: The value of the data model. You can get this value from the TD Console URL. Refer to/app/admin/datamodels/<VALUE>in the Data Model URL.YOUR_TD_APIKEY: Requires your Master TD API Key. The following document explains how to get a TD API key: https://docs.treasuredata.com/articles/#!pd/getting-your-api-keys/.
When the request executes, your TD API key for a data model will be rotated by your specified TD API key, and you will get the data model information with 200 success response like below:
{"oid":"93d34997-xxxx-xxxx-xxxx-xxxxxxxxx","name":"your_datamodel_name","type":"elasticube",
...
,"relations":[]}Build the data model after the command, you can confirm that the API key rotation works. Please reach out to Support (support@treasure-data.com) when you have any further assistance about this operation.