Get the ID of a table in Imply Polaris
You only need the table ID if you are using the deprecated v1 APIs for Polaris. The v2 APIs use the table name to reference tables. For information about migrating to v2, see the Migration guide for deprecated APIs.
Imply Polaris designates tables using universally unique identifiers (UUIDs). To operate on an individual table using the Polaris API, you need its table ID such as to accomplish the following tasks:
- Define a table's schema
- Load data from files into a table
- Stream event data into a table
- Get a table's metadata
This topic shows you how to determine your table ID.
Prerequisites
This topic assumes you have an API key to access the Polaris API.
In the examples below, the key value is stored in the variable named POLARIS_API_KEY
.
See API key authentication to obtain an API key and assign permissions.
Visit User roles reference for more information on roles and their permissions.
Identify a destination table
You can also use the Tables API to get the table ID. Issue a GET
request to the Tables API to get the list of available tables and their IDs.
Sample request
The following example shows how to get list of tables and their IDs:
- cURL
- Python
curl --location --request GET 'https://ORGANIZATION_NAME.api.imply.io/v2/tables' \
-u ${POLARIS_API_KEY}: \
--header 'Content-Type: application/json' \
--data-raw ''
import os
import requests
url = "https://ORGANIZATION_NAME.api.imply.io/v2/tables"
apikey = os.getenv("POLARIS_API_KEY")
payload = "\n"
headers = {
'Authorization': f'Basic {apikey}',
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Sample response
The response lists the name and ID for all tables in the organization. The following example shows one entry:
{
"values":[
{
"name":"demo-table",
"id":"149d245a-1207-4946-9057-88c56354482c",
"description":"wiki stream demo table",
"lastUpdateDateTime":"2022-07-19T17:54:02Z"
},
...
...
...
]
}
Learn more
See the following topics to learn more:
- Tables API for reference on the Tables API.
- Create a table for creating tables using the API.
- Ingest batch data for ingesting batch data into a table.
- Push event data for ingesting streaming data into a table.