版本控制

每个客户端请求都必须提供显式 API 版本作为查询字符串参数。 例如:https://{myconfig}.azconfig.io/kv?api-version=1.0

api-version 以 SemVer (major.minor) 格式表示。 不支持范围或版本协商。

本文适用于 API 版本 1.0。

下面概述了当请求的 API 版本无法进行匹配时服务器返回的可能的错误响应的摘要。

未指定 API 版本

当客户端在未提供 API 版本的情况下发出请求时,会发生此错误。

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 版本不受支持

当客户端请求的 API 版本与服务器所支持的任何 API 版本都不匹配时,会发生此错误。

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 版本无效

当客户端使用 API 版本发出请求,但此值格式不正确或无法由服务器分析时,会发生此错误。

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 版本不明确

当客户端请求对服务器而言不明确的 API 版本(例如多个不同的值)时,会出现此错误。

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
}