Using the REST Client
You need the domain information to use the REST client to interact with the registry.
To obtain the domain information, perform the following:
- In the Cloudera console, click the Cloudera AI tile.
- Click AI Registries in the left navigation menu. The AI Registries page displays.
- Click on the name of the Cloudera AI Registry to display the Cloudera AI Registry information. The Domain name is
displayed in the Details tab.
Get all Models
curl -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models | jq
{
"models": [
{
"created_at": "2024-04-18T15:54:15.543Z",
"creator": {
"user_name": "csso_cheyuanl"
},
"id": "5bwt-qqe2-e1vg-chqj",
"name": "foo",
"tags": null,
"updated_at": "2024-04-18T15:54:15.543Z",
"visibility": "private"
},
Get a Model
curl -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/fx0k-baf7-yszl-jrt2 | jq
{
"created_at": "2024-04-18T15:54:24.940Z",
"creator": {
"user_name": "csso_cheyuanl"
},
"id": "fx0k-baf7-yszl-jrt2",
"model_versions": [
{
"artifact_uri": "abfs://data@engmldevenvazuresan.dfs.core.windows.net/modelregistry/fx0k-baf7-yszl-jrt2/y8d8-qluc-00md-h2pw/model.tar.gz",
"created_at": "2024-04-18T15:54:24.942Z",
"model_id": "fx0k-baf7-yszl-jrt2",
"status": "READY",
"tags": null,
"updated_at": "2024-04-18T15:54:24.942Z",
"user": {
"user_name": "csso_cheyuanl"
},
"version": 1
}
],
"name": "foo2",
"tags": null,
"updated_at": "2024-04-18T15:54:24.940Z",
"visibility": "private"
}
Get a Model version
curl -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/fx0k-baf7-yszl-jrt2/versions/1 | jq
{
"artifact_uri": "abfs://data@engmldevenvazuresan.dfs.core.windows.net/modelregistry/fx0k-baf7-yszl-jrt2/y8d8-qluc-00md-h2pw/model.tar.gz",
"created_at": "2024-04-18T15:54:24.942Z",
"model_id": "fx0k-baf7-yszl-jrt2",
"status": "READY",
"tags": null,
"updated_at": "2024-04-18T15:54:24.942Z",
"user": {
"user_name": "csso_cheyuanl"
},
"version": 1
}
Patch a Model
curl -XPATCH -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/fx0k-baf7-yszl-jrt2 -d ‘{
“visibility”: “public”
}’
Patch a Model Version
curl -XPATCH -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/fx0k-baf7-yszl-jrt2/version/1 -d ‘{
“tags”: [{“key”: “k1”, “value”: “v1”}, “key”: “k2”, “value”: “v2”}]
}’
Delete a Model
curl -XDELETE -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/vuu6-gcfx-ydio-rit0
Delete a Model version
curl -XDELETE -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/vuu6-gcfx-ydio-rit0/versions/1