API:创建离线数据包
通过传入相应的ID创建对应离线数据包
文件转换ID:PUT https://api.bimface.com/files/{fileId}/offlineDatabag?callback={callback}
集成模型ID:PUT https://api.bimface.com/integrations/{integrateId}/offlineDatabag?callback={callback}
模型对比ID:PUT https://api.bimface.com/comparisions/{compareId}/offlineDatabag?callback={callback}
文件转换、集成或对比成功后,即可创建该文件的离线数据包。
请求(Request)
Header
key | value | 示例 |
---|---|---|
Authorization | bearer {accessToken} | bearer xxxx-xxxx-xxxx-xxxx |
Content-Type | application/json | … |
Url Parameter
字段 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
fileId | Number | Y | 通过文件转换ID创建离线数据包时必填 | 1199714943746080 |
integrateId | Number | Y | 通过集成模型ID创建离线数据包时必填 | 1299714943746080 |
compareId | Number | Y | 通过模型对比ID创建离线数据包时必填 | 1309714943746080 |
callback | String | N | 回调url | … |
Request Body
无
curl -X POST
-H "Authorization: bearer <your accessToken>"
-H "Content-Type: application/json"
"https://api.bimface.com/files?fileId={your fileId}/offlineDatabag?callback={callback}"
"https://api.bimface.com/integrations?integrateId={your integrateId}/offlineDatabag?callback={callback}"
"https://api.bimface.com/comparisions?compareId={your compareId}/offlineDatabag?callback={callback}"
响应(Response)
HTTP STATUS
200
成功返回
{
"code": "success",
"message": "",
"data": {
"fileId": 8167234891,
"databagVersion": "2.0",
"status": "processing",
"reason": null,
"createTime":"2016-08-08 12:36:47"
}
}
字段 | 类型 | 描述 | 示例 |
---|---|---|---|
fileId | Long | 文件转换Id,此字段也可能变为integrateId,compareId | 8167234891 |
databagVersion | String | 离线包版本 | 2.0 |
status | String | 离线包状态 | processing(生成中)、success(生成成功)、failed(生成失败) |
reason | String | 若生成失败,返回失败原因 | … |
createTime | String | 离线包生成时间 | 2016-08-08 12:36:47 |
失败返回
{
"code": "authentication.failed",
"message": "Token was not recognized."
}
错误码
code | 说明 |
---|---|
system.error | BIMFACE系统异常 |
authentication.failed | API访问合法性校验失败 |
file.not.found | 文件不存在 |
file.not.translated | 文件没有发起转换,不能生成离线包 |
file.translating | 文件正在转换中,不能生成离线包 |
file.translate.failure | 文件转换失败,不能生成离线包 |
integration.not.found | 集成模型未找到 |
integration.not.translated | 模型未集成,不能生成离线包 |
integration.translating | 模型正在集成中,不能生成离线包 |
integration.translate.failure | 模型集成失败,不能生成离线包 |
compare.not.found | 对比文件未找到 |
compare.not.translated | 对比文件没有转换,不能生成离线包 |
compare.translating | 对比文件转换中,不能生成离线包 |
compare.translate.failure | 对比文件转换失败,不能生成离线包 |
回调(Callback)
待离线包生成后,根据调用方传入的回调地址,BIMFACE会通知结果。
Method
GET
Header
key | value | 示例 |
---|---|---|
Content-Type | application/json | … |
Url Parameter
字段 | 类型 | 描述 | 示例 |
---|---|---|---|
fileId | Number | 文件ID,此字段也可能变为integrateId,compareId | 85929027838566 |
status | String | 转换状态,processing-进行中,success-完成,failed-失败 | … |
reason | String | 若集成失败,则返回失败原因 | … |
nonce | String | 回调随机数 | … |
signature | String | 签名 | … |
signature(签名):为了确保回调消息是由BIMFACE发出的,调用方在收到回调消息后,须验证签名。签名的计算方式:MD5(“appKey:appSecret:integrateId:status:nonce”),如果调用方计算的签名与BIMFACE返回的签名一致,则证明该消息是安全可靠的。