Query the workspace name¶
Query the name by the workspace ID in an existing data sharing relationship.
POST https://moi.matrixorigin.cn/newmoi/data-share/workspace-names
Preparation before calling¶
Prepare a personal access token with access to the target workspace, the target workspace ID, and a list of workspace IDs to query.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Current workspace ID, passed throughX-Workspace-IDHeader.$TARGET_WORKSPACE_ID: The workspace ID whose name is to be queried.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/data-share/workspace-names" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"ids": ["'"$TARGET_WORKSPACE_ID"'"]
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string[] |
Yes |
A list of workspace IDs to query for names. |
[] after a type means an array. For example, string[] is an array of strings.
Successful response¶
Returns 200 and the resolvable workspace name on success.
{
"code": "OK",
"msg": "OK",
"data": {
"workspaces": [
{
"id": "ws-02",
"name": "分析工作区"
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
array |
A list of resolvable workspaces. |
|
string |
Workspace ID. |
|
string |
Workspace name. |
In field paths, [] means each item in an array. For example, data.workspaces[].id is the id field of each item in data.workspaces.
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid request body format or workspace ID list. |
Check |
|
|
The current identity is not a valid member of the current workspace. |
Use credentials that have workspace access. |
|
|
The server failed to resolve the workspace name. |
Try again later. |