[M] Using the K API Examples
Get Access Token
The access token is used in the request header Authorization: Bearer <COPY ACCESS CODE HERE>
# REPLACE: <CLIENT_ID>, <USER>, <PASSWORD>
curl -X POST -u "<CLIENT_ID>:" \
-d "grant_type=password&username=<USER>&password=<PASSWORD>&scope=openid profile email" \
https://<domain>/keycloak/auth/realms/kada/protocol/openid-connect/token
# Response. The access_token will be used to authenticate API calls to KADA.
{
"access_token": "..",
"expires_in": 7200,
"refresh_expires_in": 86400,
"refresh_token": "...",
"token_type": "bearer",
"id_token": "...",
"not-before-policy": 0,
"session_state": "...",
"scope": "openid profile email"
}
export ACCESS_TOKEN=<ACCESS TOKEN FROM RESPONSE>
Get an object
Get the table with name ‘customer’
curl --location \
--request GET 'https://<domain>/api/tables?name=customer' \
--header "Authorization: Bearer ${ACCESS_TOKEN}"
Get fully qualified table name: table123, in schema3 in db2 in host1.
curl --location \
--request GET 'https://<domain>/api/tables?signature=host1.db2.schema3.table123' \
--header "Authorization: Bearer ${ACCESS_TOKEN}"
Updating a description
<TABLE ID>
can be found from the Get object call.
Adding a tag to a table
Create a tag
Link the tag to an object.
<TABLE ID>
is returned from the Get object call
<TAG ID>
is returned from the Get Tags or Create tag call
Delete a tag from an object
Adding a property to a object
A property name is unique for a given object
<OBJECT ID>
can be found from the Get object APIs.
Get a collection template
Get the Classification collection.
Response - note the properties which will be used to create collection instances.
Creating a collection instance
First create a collection and define the template in KADA via the Admin portal.
Use the properties
field from the Get collection template to map the properties values to the property id.
<COLLECTION ID>
Use Get collection template to find the collection id
First create the collection instance
Linking the collection instance to a table.
<TABLE ID>
the table being linked to the collection
<COLLECTION INSTANCE ID>
the collection instance being linked.
Adding and Steward to a table
Similarly to add an owner use the relationship relationship=OWNED_BY
Creating manual lineage to an upstream table
<TABLE ID>
this is the downstream table. Use Get to find the table id.
<UPSTREAM TABLE ID>
this is the source table. Use Get to find the table id