跳到主要内容

获取工作区权限

使用该接口可以获取当前用户对指定工作区下的项目和表的权限

请求

curl -vvv "$API_HOST/open/api/v1/workspaces/$type/$id/roles/" -H "Authorization: $access-token"

Python 示例

def get_workspace_role(access_token, workspace):
url = '%s/open/api/v1/workspaces/%s/%d/roles/' % (API_HOST, workspace['type'], workspace['id'])
headers = {'Authorization': access_token}
req = requests.get(url, headers=headers)
return req.json()

响应

响应体

名称类型描述
detailarray权限列表
∟ idint64节点ID
∟ typestring节点类型:project table org datafile
∟ rolestring权限: admin editable readonly

响应体示例

{
"code": 0,
"detail": [
{
"id": 56,
"type": "project",
"role": "admin"
},
{
"id": 55,
"type": "project",
"role": "admin"
}
],
"extra":null,
"message": "OK",
"requestID":null
}