版本控制Versioning

每个客户端请求都必须提供显式 API 版本作为查询字符串参数。Each client request must provide an explicit API version as a query string parameter. 例如:https://{myconfig}.azconfig.io/kv?api-version=1.0For example: https://{myconfig}.azconfig.io/kv?api-version=1.0.

api-version 以 SemVer (major.minor) 格式表示。api-version is expressed in SemVer (major.minor) format. 不支持范围或版本协商。Range or version negotiation isn't supported.

本文适用于 API 版本 1.0。This article applies to API version 1.0.

下面概述了当请求的 API 版本无法进行匹配时服务器返回的可能的错误响应的摘要。The following outlines a summary of the possible error responses returned by the server when the requested API version can't be matched.

未指定 API 版本API version unspecified

当客户端在未提供 API 版本的情况下发出请求时,会发生此错误。This error occurs when a client makes a request without providing an API version.

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json; charset=utf-8
{
  "type": "https://azconfig.io/errors/invalid-argument",
  "title": "API version is not specified",
  "name": "api-version",
  "detail": "An API version is required, but was not specified.",
  "status": 400
}

API 版本不受支持Unsupported API version

当客户端请求的 API 版本与服务器所支持的任何 API 版本都不匹配时,会发生此错误。This error occurs when a client requested API version doesn't match any of the supported API versions by the server.

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json; charset=utf-8
{
  "type": "https://azconfig.io/errors/invalid-argument",
  "title": "Unsupported API version",
  "name": "api-version",
  "detail": "The HTTP resource that matches the request URI '{request uri}' does not support the API version '{api-version}'.",
  "status": 400
}

API 版本无效Invalid API version

当客户端使用 API 版本发出请求,但此值格式不正确或无法由服务器分析时,会发生此错误。This error occurs when a client makes a request with an API version, but the value is malformed or can't be parsed by the server.

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json; charset=utf-8  
{
  "type": "https://azconfig.io/errors/invalid-argument",
  "title": "Invalid API version",
  "name": "api-version",
  "detail": "The HTTP resource that matches the request URI '{request uri}' does not support the API version '{api-version}'.",
  "status": 400
}

API 版本不明确Ambiguous API version

当客户端请求对服务器而言不明确的 API 版本(例如多个不同的值)时,会出现此错误。This error occurs when a client requests an API version that is ambiguous to the server (for example, multiple different values).

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json; charset=utf-8
{
  "type": "https://azconfig.io/errors/invalid-argument",
  "title": "Ambiguous API version",
  "name": "api-version",
  "detail": "The following API versions were requested: {comma separated api versions}. At most, only a single API version may be specified. Please update the intended API version and retry the request.",
  "status": 400
}