复制数据表
请求
curl -vvv "$API_HOST/open/api/v1/tablenodes/$table_id/copies/" -H "Content-Type: application/json" -H "Authorization: $access-token" -d '$request_body'
请求体
{
"projectID": 2,
"name": "newTableName",
"includeData": true,
"IncludePermission": true
}
参数说明
Name | Type | Description | Required |
---|---|---|---|
name | string | table name | Y |
projectID | int64 | project id | Y |
includeData | bool | whether include data | |
IncludePermission | bool | whether include permission |
Python 示例
def copy_table(access_token, project_id, table_id, name, include_data, include_permission):
url = '%s/open/api/v1/tablenodes/%d/copies/' % (API_HOST, table_id)
headers = {'Authorization': access_token}
data = {
"name": name,
"projectID": project_id,
"includeData": include_data,
"IncludePermission": include_permission
}
req = requests.post(url, headers=headers, json=data)
return req.json()
响应
Name | Type | Description |
---|---|---|
detail | object | created table info |
∟ id | int64 | table id |
∟ name | string | table name |
∟ type | string | table type |
∟ order | int64 | table order |
∟ createTime | string | table create time |
∟ updateTime | string | table last updated time |
∟ parentID | int64 | table group id |
∟ projectID | int64 | project id |
∟ published | bool | whether published |
∟ roleInherited | bool | whether inherited permissions |
∟ subscribed | bool | whethere subscribed |
响应示例
{
"code": 0,
"detail": {
"id": 77,
"name": "newTableName",
"type": "table",
"order": 31,
"parentID": null,
"projectID": 14,
"subscribed": false,
"published": false,
"roleInherited": true,
"createTime": "2023-05-13T12:28:28.047773+08:00",
"updateTime": "2023-05-13T12:28:28.047773+08:00"
},
"extra": null,
"message": "OK",
"requestID": null
}