# 更改文件项信息
文件管理服务支持对文件项的部分信息进行更改,另外也支持复制移动等操作。在上一节中您已学会了如何创建文件项,本节将介绍如何对文件项进行重命名,以及对文件项进行移动、复制、删除等操作。
# 1. 文件项重命名
若您希望对“BIMFACE示例文件"进行重命名,那么您可以记录下文件项ID(fileItemId),通过文件项重命名 (opens new window)接口修改名称。
# HTTP请求示例
# 请求 path
PATCH https://api.bimface.com/bdfs/data/v1/projects/10000000006016/fileItems
# 请求 header
"Authorization: Bearer cn-e9725999-0b36-4c0e-bdca-38ea88888888"
# 请求 body
{
"fileItemId" : "1938888813662955",
"fileItemName" : "sample2.rvt",
}
# HTTP响应示例
# 响应 200
{
"code" : "success",
"data" : {
"appKey" : "odatvZYUSAWMbdUjTU8HoZXB9tFt6123",
"createTime" : "2023-02-27 12:25:49",
"id": "10000022264947",
"fileId": "10000022264947",
"fileItemId" : "1938888813662955",
"name": "BIMFACE示例文件.rvt",
"fileItemName": "sample2.rvt",
"suffix" : "rvt",
"length" : 345345345,
"projectId" : "10000000006016",
"parentId" : "10000022200497",
"folder": false,
"storeId": "10000022264945",
"version": 3,
"status": "SUCCESS",
"uploadMode": "DIRECT",
"md5": "6DFB020D5761B66DA004DCF8CC09F193",
"physicalIndex": "8f2379bbf6c8460aa5929a86642720e9",
"updateTime" : "2023-02-28 09:32:54",
"current": true,
"originalCreateTime": "2023-02-24 14:55:38"
},
"message" : "success"
}
# 2. 移动文件项位置
通过移动文件项 (opens new window)接口可以移动文件项所在位置,此时文件项下的所有版本文件将同步移动。
# HTTP请求示例
# 请求 path
PATCH https://api.bimface.com/bdfs/data/v1/projects/10000000006016/fileItems/moveItem
# 请求 header
"Authorization: Bearer cn-e9725999-0b36-4c0e-bdca-38ea88888888"
# 请求 body
{
"fileItemIds" : [ "1938888813662976", "1938888813662955"],
"targetParentId" : "10000012360005"
}
# HTTP响应示例
# 响应 200
{
"code" : "success",
"data" : [
{
"appKey" : "odatvZYUSAWMbdUjTU8HoZXB9tFt6123",
"createTime" : "2023-02-27 17:18:21",
"id": "10000022320465",
"fileId": "10000022320465",
"fileItemId" : "1938888813662976",
"name": "附件4.dwg",
"fileItemName": "图纸对比A26.dwg",
"suffix": "dwg",
"length": 64545,
"projectId" : "10000000006016",
"parentId" : "10000012360005",
"folder": false,
"storeId": "10000022320463",
"version": 2,
"status": "SUCCESS",
"uploadMode": "DIRECT",
"md5": "5D43B936902C60F464B048CFFCF173B6",
"physicalIndex": "3a1c5c0c119a43ab910fdf0eb67322a0",
"updateTime" : "2023-02-27 17:22:32",
"current": true,
"originalCreateTime": "2023-02-27 17:18:14"
},
{
"appKey" : "odatvZYUSAWMbdUjTU8HoZXB9tFt6123",
"createTime" : "2023-02-27 16:35:26",
"id": "10000022320357",
"fileId": "10000022320357",
"fileItemId" : "1938888813662955",
"name": "F1-风管+桥架 .rvt",
"fileItemName": "Revit示例模型.rvt",
"suffix": "rvt",
"length": 40595456,
"projectId" : "10000000006016",
"parentId" : "10000012360005",
"folder": false,
"storeId": "10000022320355",
"version": 2,
"status": "SUCCESS",
"uploadMode": "DIRECT",
"md5": "D3020F205910B25D61D6ACCBF177878A",
"physicalIndex": "d4c9a255fbd5409f95bf14bb1d044283",
"updateTime" : "2023-02-27 17:45:03",
"current": true,
"originalCreateTime": "2023-02-24 14:55:38"
} ],
"message" : "success"
}
# 3. 复制文件项
您可以通过复制文件项 (opens new window)接口进行文件项的复制,此时复制的是该文件项的当前版本,暂不支持所有版本的复制。
# HTTP请求示例
# 请求 path
POST https://api.bimface.com/bdfs/data/v1/projects/10000000006016/fileItems/copyItem
# 请求 header
"Authorization: Bearer cn-e9725999-0b36-4c0e-bdca-38ea88888888"
# 请求 body
{
"fileItemIds": [
"1938888813662976"
],
"targetParentId": "1932727889900118",
"targetProjectId": "10000000006016"
}
# HTTP响应示例
# 响应 200
{
"code" : "success",
"data" : [ {
"appKey" : "odatvZYUSAWMbdUjTU8HoZXB9tFt6123",
"createTime" : "2022-02-02 02:02:02",
"id": "1938888813662955",
"fileId": "1938888813662955",
"fileItemId" : "1938888813662955",
"name": "示例文件(流式加载V3.0).rvt",
"fileItemName": "Revit示例模型(流式加载V3.0).rvt",
"suffix" : "rvt",
"length": 6836224,
"projectId" : "10000000006016",
"parentId" : "1932727889900118",
"folder" : false,
"storeId" : "10000000021156",
"version" : 1,
"status" : "success",
"uploadMode" : "GENERAL",
"md5" : "sdfhskbvnksdiuewriusbndskudf",
"physicalIndex" : "a72eaf22f4214a6384429f78b690c983",
"updateTime" : "2022-02-02 02:02:02",
"current": true,
"originalCreateTime": "2022-02-02 02:02:02"
} ],
"message" : "success"
}
# 4. 删除文件项
您可以通过批量删除文件项 (opens new window)接口删除所选文件项,此时文件项下所有版本也被同步删除。
# HTTP请求示例
# 请求 path
DELETE https://api.bimface.com/bdfs/data/v1/projects/10000000006016/fileItems
# 请求 header
"Authorization: Bearer cn-e9725999-0b36-4c0e-bdca-38ea88888888"
# 请求 body
[
"1938888813662976",
"1932727889900118",
"1938888893874857"
]
# HTTP响应示例
# 响应 200
{
"code" : "success",
"message" : "success"
}