Get database classification¶
List the category names in the database. The “category” here corresponds to the Schema in some databases; only connectors with list_schemas in the capability interface set to true need to perform this step.
POST $CLOUDSIGMA_API_BASE/connectors/structured/v1/source/schemas
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query the connector database and prepare the returned database name; confirm that both enabled and capabilities.list_schemas of the entry in the browsable connector interface are true. Connectors that do not support this classification level skip this page and query the object directly.
Set the operation-specific values used in the request:
$CONNECTOR_IDand$SOURCE_TYPE: View the connector ID and source type returned by the browsable connector interface.$DATABASE: Query thedata.databases[].namereturned by the database interface.
Request¶
curl -X POST "$CLOUDSIGMA_API_BASE/connectors/structured/v1/source/schemas" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"connector_id\": \"$CONNECTOR_ID\",
\"source_type\": \"$SOURCE_TYPE\",
\"database\": \"$DATABASE\"
}"
Request body
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The saved connector ID. |
|
string |
Yes |
A structured source type. |
|
string |
Yes |
The database name returned by the database discovery interface. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Successful response¶
Returns 200 on success.
{
"code": "OK",
"msg": "OK",
"data": {
"schemas": [
{
"name": "public",
"display_name": "public"
}
],
"endpoint_results": []
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object[] |
Database classification; sources that do not support this level may return an empty array. |
|
string |
Category name, this value will be used in the |
|
string |
Classification name for display. |
|
JSON[] |
Currently returns an empty array. |
[] after a type means an array. For example, string[] is an array of strings.
Error response¶
{
"code": "ErrParamInvalid",
"msg": "invalid parameter",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Field is missing, or |
Use the |
|
|
The current service does not provide structured data source discovery. |
This group of interfaces is temporarily unavailable. |
|
|
The structured data source feature is not enabled in the current workspace. |
Check if this feature is available for this workspace. |
|
|
MongoDB structured discovery is not enabled for the current workspace. |
Do not continue calling the MongoDB connector’s discovery interface. |
|
|
The service failed to list database categories. |
Keep the desensitization error message and try again. |
Follow-up operations¶
After selecting the category, bring the database and category identification query connector table.