获取ViewToken_文档_BIMFACE_BIM应用二次开发平台

API:获取ViewToken

GET  https://api.bimface.com/view/token

根据fileId、integrateId或者compareId获取viewToken,然后把viewToken传入JavaScript组件提供的接口中,即可显示工程文件。注:只有在转换或集成任务成功以后,才能获取viewToken,有效期为12小时。


请求(Request)

Header
key value 示例
Authorization bearer {accessToken} bearer xxxx-xxxx-xxxx-xxxx
Content-Type application/json
Url Parameter
字段 类型 必填 描述 示例
fileId Number N (三选一) 文件ID 939399696195776
integrateId Number N (三选一) 集成ID 987520519940704
compareId Number N (三选一) 模型对比ID 947520219940589
Request Body

curl -X GET 
-H "Authorization: bearer <your accessToken>" 
-H "Content-Type: application/json" 
"https://api.bimface.com/view/token?fileId=<your fileId>"

curl -X GET 
-H "Authorization: bearer <your accessToken>" 
-H "Content-Type: application/json" 
"https://api.bimface.com/view/token?integrateId=<your integrateId>"

curl -X GET 
-H "Authorization: bearer <your accessToken>" 
-H "Content-Type: application/json" 
"https://api.bimface.com/view/token?compareId=<your compareId>"

响应(Response)

HTTP STATUS

200

成功返回
{
    "code": "success",
    "message": null,
    "data": "389c28de59ee62e66a7d87ec12692a76"
}
字段 类型 描述 示例
data String viewToken 389c28de59ee62e66a7d87ec12692a76
失败返回
{
    "code": "authentication.failed",
    "message": "Token was not recognized."
}
错误码
code 说明
system.error BIMFACE系统异常
authentication.failed API访问合法性校验失败
file.has.not.translated 文件未转换,不能获取viewToken
file.translate.failed 文件转换失败,不能获取viewToken
file.is.translat