1. NamedVersion(命名版本)接口说明

命名版本

接口一、创建 iModel 命名版本

POST https://api.bentley.com/imodels/{id}/namedversions

创建命名版本。

在时间线上的每一个变更集可以用来创建 iModel 的新版本。然而,时间线上的一些点可以代表重要的里程碑或要保存的重要事件。iModelHub 提供了一种在时间线上用名称标记点的方法,些时间点称为命名版本。

认证

需要在请求 Header 里包含 Authorization 字段,Authorization 字段要求是有效的且带有 imodels_modify 作用域的 Bearer 令牌。

想要了解更多关于授权以及如何获取 access token的细节,请参考这个https://developer.bentley.com/apis/overview/authorization/文档

授权

用户必须在 iModel 级别上分配 imodels_write 的权限,以及至少在项目级别上分配 imodels_webview 权限。如果未配置 iModel 级别的权限,则用户必须在项目级别分配 `imodels_write 权限。

或者,用户应该是此 iModel 所属的项目所在的组织上的组织管理员。

组织管理员必须在用户管理中至少分配以下角色之一:Account Administrator(账户管理员), Co-Administrator(联合管理员), or CONNECT Services Administrator(CONNECT 服务管理员)。想要了解更多有关于用户管理的信息,请查看 Bentley 社区 的 wiki 页面 https://communities.bentley.com/communities/other_communities/licensing_cloud_and_web_services/w/wiki/50711/user-management-2-0

接口使用率限制

所有在 iTwin Platform 上的接口都有接口使用率限制。想了解更多相关信息请查看 https://developer.bentley.com/apis/overview/rate-limits/

请求

请求参数

参数名称 所在位置 是否必须 描述
id template iModel 的 ID
请求头
名称 是否必须 描述
Authorization 带有 imodels:read 作用域的 OAuth 访问令牌
Accept 推荐设置为 application/vnd.bentley.itwin-platform.v1+json
Content-Type 标识请求主体的内容类型。支持的类型为 application/json
请求主体

命名版本(创建)

名称 类型 是否必须? 描述
name String 命名版本的名称
description String, null 命名版本的描述
changesetId String, null 用于创建命名版本的变更集的 ID。如果未提供,则一个基线文件的 iModel 命名版本会被创建

例子

{
    "name": "Wind farm design",
    "description": "Finalized wind farm design in Sun City",
    "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349"
}
响应
  1. 返回 201 Created:

    Created

    {
        "namedVersion": {
            "id": "3020441b-e179-4334-a59a-4fb8deb93df1",
            "displayName": "Wind farm design",
            "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349",
            "changesetIndex": 14,
            "name": "Wind farm design",
            "description": "Finalized wind farm design in Sun City",
            "createdDateTime": "2020-10-21T06:42:57.6700000Z",
            "state": "visible",
            "_links": {
                "creator": {
                    "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/users/ea4dfb9f-7f66-4c6f-82c5-0efad1636a1f"
                },
                "changeset": {
                    "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/changesets/1f2e04b666edce395e37a795e2231e995cbf8349"
                }
            }
        }
    }
    
  2. 返回 401 Unauthorized:

此响应表示请求缺少有效的身份验证凭据。访问令牌可能未提供、或是由错误的颁发者颁发、没有所需的作用域或请求头的格式不正确。

{
    "error": {
        "code": "Unauthorized",
        "message": "Access denied due to invalid access_token. Make sure to provide a valid token for this API endpoint."
    }
}
  1. Response 403 Forbidden:

    用户无权创建命名版本

    {
        "error": {
            "code": "InsufficientPermissions",
            "message": "The user has insufficient permissions for the requested operation."
        }
    }
    
  2. Response 404 Not Found:

无法找到指定的 iModel

{
    "error": {
        "code": "iModelNotFound",
        "message": "Requested iModel is not available."
    }
}
  1. Response 409 Conflict

    (1)已存在同名的命名版本

    {
        "error": {
            "code": "NamedVersionExists",
            "message": "Named Version with the same name already exists within the iModel."
        }
    }
    

    (2)使用当前变更集的命名版本已存在

    {
        "error": {
            "code": "NamedVersionOnChangesetExists",
            "message": "Named Version for specified Changeset already exists."
        }
    }
    
  2. Response 422 Unprocessable Entity:

状态代码表示由于客户端错误(例如,格式错误的请求语法),服务器无法处理请求。

(1)无效 iModel 请求

{
    "error": {
        "code": "InvalidiModelsRequest",
        "message": "Cannot create Named Version.",
        "details": [{
                "code": "InvalidValue",
                "message": "Provided 'name' is not valid. The value exceeds allowed 255 characters.",
                "target": "name"
            },
            {
                "code": "InvalidHeaderValue",
                "message": "'application/xml' is not supported 'content-type'. Supported media type is 'application/json'.",
                "target": "content-type"
            },
            {
                "code": "MissingRequiredProperty",
                "message": "Required property is missing.",
                "target": "name"
            },
            {
                "code": "InvalidRequestBody",
                "message": "Failed to parse request body. Make sure it is a valid JSON."
            }
        ]
    }
}

(2)请求主体缺失

{
    "error": {
        "code": "MissingRequestBody",
        "message": "Request body was not provided."
    }
}
  1. Response 429 Too many requests:

此响应表示用户在给定的时间内发送了太多请求

{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

响应头

名称 描述
retry-after 超过客户端订阅的速率限制的请求数
接口二、获取命名版本的检查点

GET https://api.bentley.com/imodels/{id}/namedversions/{namedVersionId}/checkpoint

检查点是一个预处理的 iModel 基线文件,其中包含已应用的特定更改集的更改,并存储在服务器上。这可以用来减少应用到特定版本的 iModel 所需的变更集数量。

当为变更集创建命名版本时,将生成一个检查点。

检查点可以以两种不同的形式存储起来:

  • download 属性会包含一个指向完整的 .bim 文件的 Azure Blob 存储链接,这个 .bim 文件所含的更改应用于通过 changesetIndex 和 changesetId 属性指定的变更集。
  • containerAccessInfo 将拥有 Azure Blob 容器的访问密钥,该容器将检查点存储在4 MB块中。重要提示:此属性只能由 iTwin.js 库使用。

成功生成的检查点将具有一个或两个属性。

认证

需要在请求 Header 里包含 Authorization 字段,Authorization 字段要求是有效的且带有 imodels:read 作用域的 Bearer 令牌。

想要了解更多关于授权以及如何获取 access token的细节,请参考这个https://developer.bentley.com/apis/overview/authorization/文档

授权

用户必须在 iModel 级别上分配 imodels_read 的权限,以及至少在项目级别上分配 imodels_webview 权限。如果未配置 iModel 级别的权限,则用户必须在项目级别分配 imodels_read 权限。

或者,用户应该是此 iModel 所属的项目所在的组织上的组织管理员。

组织管理员必须在用户管理中至少分配以下角色之一:Account Administrator(账户管理员), Co-Administrator(联合管理员), or CONNECT Services Administrator(CONNECT 服务管理员)。想要了解更多有关于用户管理的信息,请查看 Bentley 社区 的 wiki 页面 https://communities.bentley.com/communities/other_communities/licensing_cloud_and_web_services/w/wiki/50711/user-management-2-0

接口使用率限制

所有在 iTwin Platform 上的接口都有接口使用率限制。想了解更多相关信息请查看 https://developer.bentley.com/apis/overview/rate-limits/

请求

请求参数

参数名称 所在位置 是否必须 描述
id template iModel 的 ID
namedVersionId template 命名版本的 ID
请求头
名称 是否必须 描述
Authorization 带有 imodels:read 作用域的 OAuth 访问令牌
Accept 推荐设置为 application/vnd.bentley.itwin-platform.v1+json
响应
  1. 返回 200 OK:

    OK

    {
        "checkpoint": {
            "changesetIndex": 1,
            "changesetId": "a1ecbdc8c4f6173004f9f881914a57c5511a362b",
            "state": "successful",
            "containerAccessInfo": {
                "account": "imodelhubsa01",
                "sas": "?sv=2019-07-07&sr=b&sig=ByGsPs4cwKyUfnV6%2BjDZFDL3J7QiE0vl917MCX%2FC35Y%3D&st=2021-07-30T10%3A53%3A09.5224547Z&se=2021-07-30T11%3A13%3A09.5224552Z&sp=r",
                "container": "imodelblocks-5e19bee0-3aea-4355-a9f0-c6df9989ee7d",
                "dbName": "a1ecbdc8c4f6173004f9f881914a57c5511a362b.bim"
            },
            "_links": {
                "download": {
                    "href": "https://imodelhub.blob.core.windows.net/imodelhub-5e19bee0-3aea-4355-a9f0-c6df9989ee7d/5e19bee0-3aea-4355-a9f0-c6df9989ee7d.bim?sv=2019-07-07&sr=b&sig=ByGsPs4cwKyUfnV6%2BjDZFDL3J7QiE0vl917MCX%2FC35Y%3D&st=2021-07-30T10%3A53%3A09.5224547Z&se=2021-07-30T11%3A13%3A09.5224552Z&sp=r"
                }
            }
        }
    }
    
  2. 返回 401 Unauthorized:

此响应表示请求缺少有效的身份验证凭据。访问令牌可能未提供、或是由错误的颁发者颁发、没有所需的作用域或请求头的格式不正确。

{
    "error": {
        "code": "Unauthorized",
        "message": "Access denied due to invalid access_token. Make sure to provide a valid token for this API endpoint."
    }
}
  1. Response 404 Not Found:

(1)未找到指定的 iModel

{
    "error": {
        "code": "iModelNotFound",
        "message": "Requested iModel is not available."
    }
}

(2)未找到指定的命名版本

{
    "error": {
        "code": "NamedVersionNotFound",
        "message": "Requested Named Version is not available."
    }
}

(3)未找到指定的检查点

{
    "error": {
        "code": "CheckpointNotFound",
        "message": "Requested Checkpoint is not available."
    }
}
  1. Response 429 Too many requests:

此响应表示用户在给定的时间内发送了太多请求

{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

响应头

名称 描述
retry-after 超过客户端订阅的速率限制的请求数
接口三、获取 iModel 的命名版本

GET https://api.bentley.com/imodels/{id}/namedversions/{namedVersionId}

获取命名版本的详情。

在时间线上的每一个变更集可以用来创建 iModel 的新版本。然而,时间线上的一些点可以代表重要的里程碑或要保存的重要事件。iModelHub 提供了一种在时间线上用名称标记点的方法,些时间点称为命名版本。

认证

需要在请求 Header 里包含 Authorization 字段,Authorization 字段要求是有效的且带有 imodels:read 作用域的 Bearer 令牌。

想要了解更多关于授权以及如何获取 access token的细节,请参考这个https://developer.bentley.com/apis/overview/authorization/文档

授权

用户必须在 iModel 级别上分配 imodels_webview 的权限,以及至少在项目级别上分配 imodels_webview 权限。如果未配置 iModel 级别的权限,则用户必须在项目级别分配 imodels_webview 权限。

或者,用户应该是此 iModel 所属的项目所在的组织上的组织管理员。

组织管理员必须在用户管理中至少分配以下角色之一:Account Administrator(账户管理员), Co-Administrator(联合管理员), or CONNECT Services Administrator(CONNECT 服务管理员)。想要了解更多有关于用户管理的信息,请查看 Bentley 社区 的 wiki 页面 https://communities.bentley.com/communities/other_communities/licensing_cloud_and_web_services/w/wiki/50711/user-management-2-0

接口使用率限制

所有在 iTwin Platform 上的接口都有接口使用率限制。想了解更多相关信息请查看 https://developer.bentley.com/apis/overview/rate-limits/

请求

请求参数

参数名称 所在位置 是否必须 描述
id template iModel 的 ID
namedVersionId template 命名版本的 ID
请求头
名称 是否必须 描述
Authorization 带有 imodels:read 作用域的 OAuth 访问令牌
Accept 推荐设置为 application/vnd.bentley.itwin-platform.v1+json
响应
  1. 返回 200 OK:

    OK

    {
        "namedVersion": {
            "id": "3020441b-e179-4334-a59a-4fb8deb93df1",
            "displayName": "Wind farm design",
            "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349",
            "changesetIndex": 14,
            "name": "Wind farm design",
            "description": "Finalized wind farm design in Sun City",
            "createdDateTime": "2020-10-21T06:42:57.6700000Z",
            "state": "visible",
            "_links": {
                "creator": {
                    "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/users/ea4dfb9f-7f66-4c6f-82c5-0efad1636a1f"
                },
                "changeset": {
                    "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/changesets/1f2e04b666edce395e37a795e2231e995cbf8349"
                }
            }
        }
    }
    
  2. 返回 401 Unauthorized:

此响应表示请求缺少有效的身份验证凭据。访问令牌可能未提供、或是由错误的颁发者颁发、没有所需的作用域或请求头的格式不正确。

{
    "error": {
        "code": "Unauthorized",
        "message": "Access denied due to invalid access_token. Make sure to provide a valid token for this API endpoint."
    }
}
  1. Response 404 Not Found:

(1)无法找到指定的 iModel

{
    "error": {
        "code": "iModelNotFound",
        "message": "Requested iModel is not available."
    }
}

(2)命名版本无法找到

{
    "error": {
        "code": "NamedVersionNotFound",
        "message": "Requested Named Version is not available."
    }
}
  1. Response 429 Too many requests:

此响应表示用户在给定的时间内发送了太多请求

{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

响应头

名称 描述
retry-after 超过客户端订阅的速率限制的请求数
接口四、获取 iModel 的命名版本列表

GET https://api.bentley.com/imodels/{id}/namedversions[?$top][&$skip][&$orderBy][&name]

通过 iModel Id 获取 iModel 的命名版本列表

说明

Header 中的 Perfer 可用于指定客户端需要多少元数据结果。Preer 用于指示特定的服务器行为是客户端首选的,但不是成功完成请求所必需的。

此操作支持“return=representation”和“return=minimal”首选项。

“return=representation”首选项表示客户端希望服务器在响应成功请求时包含一个表示资源当前状态的实体。“return=minimal”首选项表示客户端希望服务器对成功的请求只返回最小的响应。如果未指定首选标头,则这是默认首选项。

认证

需要在请求 Header 里包含 Authorization 字段,Authorization 字段要求是有效的且带有 imodels:read 作用域的 Bearer 令牌。

想要了解更多关于授权以及如何获取 access token的细节,请参考这个https://developer.bentley.com/apis/overview/authorization/文档

授权

用户必须在 iModel 级别上分配 imodels_webview 的权限,以及至少在项目级别上分配 imodels_webview 权限。如果未配置 iModel 级别的权限,则用户必须在项目级别分配 imodels_webview 权限。

或者,用户应该是此 iModel 所属的项目所在的组织上的组织管理员。

组织管理员必须在用户管理中至少分配以下角色之一:Account Administrator(账户管理员), Co-Administrator(联合管理员), or CONNECT Services Administrator(CONNECT 服务管理员)。想要了解更多有关于用户管理的信息,请查看 Bentley 社区 的 wiki 页面 https://communities.bentley.com/communities/other_communities/licensing_cloud_and_web_services/w/wiki/50711/user-management-2-0

接口使用率限制

所有在 iTwin Platform 上的接口都有接口使用率限制。想了解更多相关信息请查看 https://developer.bentley.com/apis/overview/rate-limits/

请求

请求参数

参数名称 所在位置 是否必须 描述
id template iModel 的 ID
$top query $top 请求查询的集合结果中中要包含结果的数目。例如,仅返回第一个集合项,请提供以下查询:$top=1。如果此参数未提供则默认为100。此参数的值不能超过1000
$skip query $skip 选项请求查询集合中要跳过且不包含在结果中的项数。例如,要从第三位开始返回集合中的项目,请提供以下查询:$skip=2。
$orderBy query $orderBy 选项允许客户端使用“asc”请求升序,或使用“desc”请求降序,按其中一个项属性对返回的集合进行排序。目前,变更集唯一受支持的属性是“index”。如果未指定“asc”或“desc”关键字,则集合将按升序排序。要按降序排列集合,请提供'desc'关键字,例如:$orderBy=index desc
name query 名称选项允许用户按名称属性筛选命名版本。例如,要返回名称等于'Milestone 1'的命名版本,请提供以下查询:name=Milestone%201。此参数的有效值遵循与命名版本创建相同的要求——字符串不应为空,不应仅由空格组成,且不应超过255个字符。此查询选项使用精确匹配。
请求头
名称 是否必须 描述
Authorization 带有 imodels:read 作用域的 OAuth 访问令牌
Accept 推荐设置为 application/vnd.bentley.itwin-platform.v1+json
Prefer 标识响应中所携带信息的详细等级。此操作支持“return=representation”和“return=minimal”首选项
响应
  1. 返回 200 OK:

    OK

    (1)Prefer: return=minimal

    {
        "namedVersions": [{
                "id": "1083a893-0f60-4918-8fb0-c3feebf84d6a",
                "displayName": "Solar farm design",
                "changesetId": "9913e22a00eb1086c6be0ed3d09e692738fdfe9d",
                "changesetIndex": 11
            },
            {
                "id": "3020441b-e179-4334-a59a-4fb8deb93df1",
                "displayName": "Wind farm design",
                "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349",
                "changesetIndex": 14
            }
        ],
        "_links": {
            "self": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions?$skip=0&$top=100"
            },
            "prev": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions?$skip=0&$top=100"
            },
            "next": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions?$skip=100&$top=100"
            }
        }
    }
    

    (2)Prefer: return=representation

    {
        "namedVersions": [{
                "id": "1083a893-0f60-4918-8fb0-c3feebf84d6a",
                "displayName": "Solar farm design",
                "changesetId": "9913e22a00eb1086c6be0ed3d09e692738fdfe9d",
                "changesetIndex": 11,
                "description": "Finalized solar farm design in Sun City",
                "name": "Solar farm design",
                "createdDateTime": "2020-10-22T07:46:50.987Z",
                "state": "visible",
                "_links": {
                    "creator": {
                        "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/users/64c58b5e-ba12-4e2a-8f0d-5f898009cfe2"
                    },
                    "changeset": {
                        "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/changesets/9913e22a00eb1086c6be0ed3d09e692738fdfe9d"
                    }
                }
            },
            {
                "id": "3020441b-e179-4334-a59a-4fb8deb93df1",
                "displayName": "Wind farm design",
                "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349",
                "changesetIndex": 14,
                "description": "Finalized wind farm design in Sun City",
                "name": "Wind farm design",
                "createdDateTime": "2020-10-21T06:42:57.6700000Z",
                "state": "hidden",
                "_links": {
                    "creator": {
                        "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/users/64c58b5e-ba12-4e2a-8f0d-5f898009cfe2"
                    },
                    "changeset": {
                        "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/changesets/1f2e04b666edce395e37a795e2231e995cbf8349"
                    }
                }
            }
        ],
        "_links": {
            "self": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions?$skip=0&$top=100"
            },
            "prev": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions?$skip=0&$top=100"
            },
            "next": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions?$skip=100&$top=100"
            }
        }
    }
    
  2. 返回 401 Unauthorized:

此响应表示请求缺少有效的身份验证凭据。访问令牌可能未提供、或是由错误的颁发者颁发、没有所需的作用域或请求头的格式不正确。

{
    "error": {
        "code": "Unauthorized",
        "message": "Access denied due to invalid access_token. Make sure to provide a valid token for this API endpoint."
    }
}
  1. Response 404 Not Found:

请求的 iModel 无效

{
    "error": {
        "code": "iModelNotFound",
        "message": "Requested iModel is not available."
    }
}
  1. Response 422 Unprocessable Entity:

    状态代码表示由于客户端错误(例如,格式错误的请求语法),服务器无法处理请求。

    {
        "error": {
            "code": "InvalidiModelsRequest",
            "message": "Cannot get Named Versions.",
            "details": [{
                "code": "InvalidValue",
                "message": "'-1' is not a valid '$skip' value. '$skip' must be a non-negative integer.",
                "target": "$skip"
            }]
        }
    }
    
  2. Response 429 Too many requests:

此响应表示用户在给定的时间内发送了太多请求

{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

响应头

名称 描述
retry-after 超过客户端订阅的速率限制的请求数
接口五、更新 iModel 的命名版本

PATCH https://api.bentley.com/imodels/{id}/namedversions/{namedVersionId}

更新命名版本的元数据。

在时间线上的每一个变更集可以用来创建 iModel 的新版本。然而,时间线上的一些点可以代表重要的里程碑或要保存的重要事件。iModelHub 提供了一种在时间线上用名称标记点的方法,些时间点称为命名版本。

认证

需要在请求 Header 里包含 Authorization 字段,Authorization 字段要求是有效的且带有 imodels:modify 作用域的 Bearer 令牌。

想要了解更多关于授权以及如何获取 access token的细节,请参考这个https://developer.bentley.com/apis/overview/authorization/文档

授权

用户必须在 iModel 级别上分配 imodels_write 的权限,以及至少在项目级别上分配 imodels_webview 权限。如果未配置 iModel 级别的权限,则用户必须在项目级别分配 `imodels_write 权限。

或者,用户应该是此 iModel 所属的项目所在的组织上的组织管理员。

组织管理员必须在用户管理中至少分配以下角色之一:Account Administrator(账户管理员), Co-Administrator(联合管理员), or CONNECT Services Administrator(CONNECT 服务管理员)。想要了解更多有关于用户管理的信息,请查看 Bentley 社区 的 wiki 页面 https://communities.bentley.com/communities/other_communities/licensing_cloud_and_web_services/w/wiki/50711/user-management-2-0

接口使用率限制

所有在 iTwin Platform 上的接口都有接口使用率限制。想了解更多相关信息请查看 https://developer.bentley.com/apis/overview/rate-limits/

请求

请求参数

参数名称 所在位置 是否必须 描述
id template iModel 的 ID
namedVersionId template 命名版本的 ID
请求头
名称 是否必须 描述
Authorization 带有 imodels:read 作用域的 OAuth 访问令牌
Accept 推荐设置为 application/vnd.bentley.itwin-platform.v1+json
Content-Type 标识请求主体的内容类型。支持的类型为 application/json
请求主体

命名版本(更新)

名称 类型 是否必须? 描述
name String 命名版本的名称
description String, null 命名版本的描述
state String, null 用于标识命名版本的状态。'hidden'标识命名版本应该隐藏在用户界面。'visible'标识命名版本应该出现在用户界面上

例子

{
    "name": "Wind farm design",
    "description": "Finalized wind farm design in Sun City",
    "state": "hidden"
}
响应
  1. 返回 200 OK:

    OK

    {
        "namedVersion": {
            "id": "3020441b-e179-4334-a59a-4fb8deb93df1",
            "displayName": "Wind farm design",
            "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349",
            "changesetIndex": 14,
            "name": "Wind farm design",
            "description": "Finalized wind farm design in Sun City",
            "createdDateTime": "2020-10-21T06:42:57.6700000Z",
            "state": "visible",
            "_links": {
                "creator": {
                    "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/users/ea4dfb9f-7f66-4c6f-82c5-0efad1636a1f"
                },
                "changeset": {
                    "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/changesets/1f2e04b666edce395e37a795e2231e995cbf8349"
                }
            }
        }
    }
    
  2. 返回 401 Unauthorized:

此响应表示请求缺少有效的身份验证凭据。访问令牌可能未提供、或是由错误的颁发者颁发、没有所需的作用域或请求头的格式不正确。

{
    "error": {
        "code": "Unauthorized",
        "message": "Access denied due to invalid access_token. Make sure to provide a valid token for this API endpoint."
    }
}
  1. Response 403 Forbidden:

    用户无权更新命名版本

    {
        "error": {
            "code": "InsufficientPermissions",
            "message": "The user has insufficient permissions for the requested operation."
        }
    }
    
  2. Response 404 Not Found:

(1)无法找到指定的 iModel

{
    "error": {
        "code": "iModelNotFound",
        "message": "Requested iModel is not available."
    }
}

(2)命名版本无法找到

{
    "error": {
        "code": "NamedVersionNotFound",
        "message": "Requested Named Version is not available."
    }
}
  1. Response 409 Conflict:

iModel 中已存在同名的命名版本

{
    "error": {
        "code": "NamedVersionExists",
        "message": "Named Version with the same name already exists within the iModel."
    }
}
  1. Response 422 Unprocessable Entity:

    状态代码表示由于客户端错误(例如,格式错误的请求语法),服务器无法处理请求。

    (1)不合法的 iModels 请求

    {
        "error": {
            "code": "InvalidiModelsRequest",
            "message": "Cannot update Named Version.",
            "details": [{
                    "code": "InvalidValue",
                    "message": "Provided 'name' is not valid. The value exceeds allowed 255 characters.",
                    "target": "id"
                },
                {
                    "code": "InvalidHeaderValue",
                    "message": "'application/xml' is not supported 'content-type'. Supported media type is 'application/json'.",
                    "target": "content-type"
                },
                {
                    "code": "MissingRequiredProperty",
                    "message": "Required property is missing. At least one of the following properties must be provided: 'name', 'description', 'state'."
                },
                {
                    "code": "InvalidRequestBody",
                    "message": "Failed to parse request body. Make sure it is a valid JSON."
                }
            ]
        }
    }
    

    (2)请求主体缺失

    {
        "error": {
            "code": "MissingRequestBody",
            "message": "Request body was not provided."
        }
    }
    
  2. Response 429 Too many requests:

此响应表示用户在给定的时间内发送了太多请求

{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

响应头

名称 描述
retry-after 超过客户端订阅的速率限制的请求数

results matching ""

    No results matching ""