Query the workspace name¶
Query the name based on the workspace ID in the existing data sharing relationship.
POST $CLOUDSIGMA_API_BASE/data-share/workspace-names
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare the personal access token that can access the target workspace, the target workspace ID, and the list of workspace IDs to be queried.
Request body¶
The example uses jq to construct the JSON request body. Install jq before running, and set the environment variables in the example. Do not re-encode the JSON generated by jq.
curl -X POST "$CLOUDSIGMA_API_BASE/data-share/workspace-names" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
--data-binary "$(jq -n --arg TARGET_WORKSPACE_ID "$TARGET_WORKSPACE_ID" '
{
"ids": [
$TARGET_WORKSPACE_ID
]
}
')"
The ID list can be omitted and filled in with null or []. The service will ignore empty items and remove duplicates, retain the order of first occurrence, and query up to 200 different IDs.
Only workspaces that have a sharing relationship with the current workspace and are in normal status are returned. Items not found are omitted, and a success response and an empty list may be returned if the record fails to be read. Querying the name does not mean that you have access rights to the workspace.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
array of string |
No |
The workspace ID to be resolved. Can be omitted, null or empty array, up to 200 deduplication IDs. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"workspaces": [
{
"id": "ws-02",
"name": "分析工作区"
}
]
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object |
response data. |
|
array of object |
Resolvable workspace list. |
|
string |
workspace ID. |
|
string |
workspace name. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Error description. |
|
null |
Empty on error. |
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
400 |
|
Invalid request field, workspace, or operation precondition. |
Fix the request parameters and submit again. |
403 |
|
The current identity or active role does not have permission for this operation. |
Use an authorized identity or contact an administrator to grant access. |
404 |
|
The target object or required reference was not found. |
Verify the object identifier, workspace, and current status. |
500 |
|
Internal processing failed; write operations may have been partially applied. |
Retain request and trace details, and verify the current state before retrying. |
503 |
|
A business, runtime, or authorization dependency is temporarily unavailable. |
After the dependency recovers, check existing results first instead of blindly repeating writes. |