标头Headers

本文提供了与 Azure 应用配置 REST API 配合使用的标头的参考页链接。This article provides links to reference pages for headers used with the Azure App Configuration REST API.

请求标头Request Headers

下表介绍了 Azure 应用配置中使用的常见请求标头。The following table describes common request headers used in Azure App Configuration.

标头Header 说明Description 示例Example
授权Authorization 用于对服务请求进行身份验证Used to authenticate a request to the service. 请参阅第 14.8 节See section 14.8 Authorization: HMAC-SHA256 Credential=<Credential>&SignedHeaders=Host;x-ms-date;x-ms-content-sha256&Signature=<Signature>
接受Accept 向服务器通知客户端将在 HTTP 响应中接受哪一媒体类型。Informs the server what media type the client will accept in an HTTP response. 请参阅第 14.1 节See section 14.1 Accept: application/vnd.microsoft.appconfig.kv+json;
Accept-DatetimeAccept-Datetime 请求服务器将其内容作为其之前状态的表示形式返回。Requests the server to return its content as a representation of its prior state. 此标头的值是该状态的请求日期/时间。The value of this header is the requested datetime of that state. 请参阅 RFC 7089See RFC 7089 Accept-Datetime: Sat, 12 May 2018 02:10:00 GMT
Content-TypeContent-Type 包含 HTTP 请求正文中内容的媒体类型。Contains the media-type of the content within the HTTP request body. 请参阅第 14.17 节See section 14.17 Content-Type: application/vnd.microsoft.appconfig.kv+json; charset=utf-8;
日期Date 发出 HTTP 请求的日期/时间。The datetime that the HTTP request was issued. 此标头用于 HMAC 身份验证This header is used in HMAC authentication. 请参阅第 14.18 节See section 14.18 Date: Fri, 11 May 2018 18:48:36 GMT
主机Host 指定已为其发出请求的租户。Specifies the tenant for which the request has been issued. 此标头用于 HMAC 身份验证This header is used in HMAC authentication. 请参阅第 14.23 节See section 14.23 Host: contoso.azconfig.io
If-MatchIf-Match 用于使 HTTP 请求成为有条件的请求。Used to make an HTTP request conditional. 仅当目标资源的 ETag 与此标头的值匹配时,该请求才会成功。This request should only succeed if the targeted resource's ETag matches the value of this header. “*”值匹配任何 ETag。The '*' value matches any ETag. 请参阅第 14.24 节See section 14.24 If-Match: "4f6dd610dd5e4deebc7fbaef685fb903"
If-None-MatchIf-None-Match 用于使 HTTP 请求成为有条件的请求。Used to make an HTTP request conditional. 仅当目标资源的 ETag 与此标头的值不匹配时,该请求才会成功。This request should only succeed if the targeted resource's ETag does not match the value of this header. “*”值匹配任何 ETag。The '*' value matches any ETag. 请参阅第 14.26 节See section 14.26 If-None-Match: "4f6dd610dd5e4deebc7fbaef685fb903"
Sync-TokenSync-Token 用于在处理一系列的请求期间实现实时一致性。Used to enable real-time consistency during a sequence of requests. Sync-Token: jtqGc1I4=MDoyOA==;sn=28
x-ms-client-request-idx-ms-client-request-id 客户端提供的唯一 ID,用于跟踪请求的往返。A unique ID provided by the client used to track a request's round-trip. x-ms-client-request-id: 00000000-0000-0000-0000-000000000000
x-ms-content-sha256x-ms-content-sha256 HTTP 请求正文的 sha256 摘要。A sha256 digest of the HTTP request body. 此标头用于 HMAC 身份验证This header is used in HMAC authentication. x-ms-content-sha256: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
x-ms-datex-ms-date 如果 Date 标头不可供访问,则可以设置此 x-ms-date 标头,并将其用于替代 Date 标头。This header may be set and used in place of the Date header if the date header is unable to be accessed. 此标头用于 HMAC 身份验证This header is used in HMAC authentication. x-ms-date: Fri, 11 May 2018 18:48:36 GMT
x-ms-return-client-request-idx-ms-return-client-request-id x-ms-client-request-id 标头结合使用。Used in conjunction with the x-ms-client-request-id header. 如果此标头的值为“true”,则服务器将被指示返回 x-ms-client-request-id 请求标头的值。If the value of this header is 'true', then the server will be instructed to return the value of the x-ms-client-request-id request header. x-ms-return-client-request-id: true

响应标头Response Headers

服务器可能会将以下 HTTP 标头包含在其响应中。The server may include the following HTTP headers in its responses.

标头Header 说明Description 示例Example
Content-TypeContent-Type 包含 HTTP 响应正文中内容的媒体类型。Contains the media-type of the content within the HTTP response body. 请参阅第 14.17 节See section 14.17 Content-Type: application/vnd.microsoft.appconfig.kv+json; charset=utf-8;
ETagETag 一个不透明的标记,表示给定资源的状态。An opaque token representing the state of a given resource. 可用于条件运算。Can be used in conditional operations. 请参阅第 14.19 节See section 14.19 ETag: "4f6dd610dd5e4deebc7fbaef685fb903"
Last-ModifiedLast-Modified 描述上次修改所请求资源的时间。Describes when the requested resource was last modified. 已格式化为 HTTP-DateFormatted as an HTTP-Date. 请参阅第 14.29 节See section 14.29 Last-Modified: Tue, 05 Dec 2017 02:41:26 GMT
链接Link 提供与响应相关的资源的链接。Provides links to resources that are related to the response. 此标头用于使用“next”链接进行分页。This header is used for paging by using the next link. 请参阅 RFC 5988See RFC 5988 Link: </kv?after={token}>; rel="next"
Memento-DatetimeMemento-Datetime 指示响应中包含的内容表示以前的状态。Indicates that the content contained in a response represents a prior state. 此标头的值是该状态的日期/时间。The value of this header is the datetime of that state. 请参阅 RFC 7089See RFC 7089 Memento-Datetime: Sat, 12 May 2018 02:10:00 GMT
retry-after-msretry-after-ms 提供了建议该客户端在重试失败的请求前等待的时间段(以毫秒为单位)。Provides a suggested period (in milliseconds) for the client to wait before retrying a failed request. retry-after-ms: 10
x-ms-request-idx-ms-request-id 服务器生成的唯一 ID,用于在服务中跟踪请求。A unique ID generated by the server that is used to track the request within the service. x-ms-request-id: 00000000-0000-0000-0000-000000000000
WWW-AuthenticateWWW-Authenticate 用于质询客户端以进行身份验证,并提供有关身份验证尝试失败的原因。Used to challenge clients for authentication and provide a reason as to why an authentication attempt has failed. 请参阅第 14.47 节See section 14.47 WWW-Authenticate: HMAC-SHA256 error="invalid_token" error_description="Invalid Signature"