IAM 身份中心-构造请求:请求消息头

时间:2024-03-29 11:12:47

请求消息头

添加请求头字段,如指定的URI和HTTP方法所要求的字段。例如定义消息体类型的请求头“Content-Type”,请求鉴权信息等。

如下公共消息头需要添加到请求中。

  • Content-Type:消息体的类型(格式),必选,默认取值为“application/json”
  • Authorization:请求消息中可带的签名信息,必选,AK/SK认证的详细说明请参见:AK/SK认证
  • X-Sdk-Date:请求发送的时间,必选,例如:20221107T020014Z。
  • Host:表明主机地址,必选,如identitycenter.myhuaweicloud.com。

    API支持使用AK/SK认证,AK/SK认证是使用SDK对请求进行签名,签名过程会自动往请求中添加Authorization(签名认证信息)和X-Sdk-Date(请求发送的时间)请求头。AK/SK认证的详细说明请参见:AK/SK认证

对于列出实例接口,请求如下所示。

GET https://identitycenter.myhuaweicloud.com/v1/instances
content-type: application/json
X-Sdk-Date: 20230330T021902Z 
host: identitycenter.myhuaweicloud.com
Authorization: SDK-HMAC-SHA256 Access=xxxxxxxxxxxxxxxxxxx, SignedHeaders=content-type;host;x-sdk-date, Signature=xxxxxxxxxxxxxxxxxxxx
support.huaweicloud.com/api-identitycenter/iic_04_0015.html