Public request header

Last Updated: Apr 10, 2017

Log Service APIs are HTTP-based interfaces in the REST style. The Log Service API supports a set of public request headers that can be used in all API requests (unless stated otherwise, each Log Service API request must provide these public request headers). The detailed definitions are given below.

Header name Type Description
Accept String Type of public request headers that the client expects from the server. Currently, application/json and application/x-protobuf are supported. This field is optional and valid only for GET requests. For the specific value, see the specific interface’s definition.
Accept-Encoding String Compression algorithm that the client expects from the server. Currently, options include LZ4, DEFLATE or empty (no compression). This field is optional and valid only for GET requests. For the specific value, see the specific interface’s definition.
Authorization String Signature content. For more details, refer to Request signature.
Content-Length Numeric Value Length of the HTTP request Body defined in RFC 2616. If the request has no Body, it is not necessary to provide this request header.
Content-MD5 String String produced after the request Body undergoes MD5 computation, results in uppercase. If the request has no Body, it is not necessary to provide this request header.
Content-Type String Type of the HTTP request Body defined in RFC 2616. Currently, Log Service API requests support only application/x-protobuf. If the request has no Body, it is not necessary to provide this request header. For the specific value, see the specific interface’s definition.
Date String The current time when sent. Currently, the parameter supports only the RFC 822 format, and the GMT standard time is used. The formatted string is as follows: %a, %d %b %Y %H:%M:%S GMT (for example: Mon, 3 Jan 2010 08:33:47 GMT).
Host String Complete HOST name of the HTTP request (does not include http:// and other such protocol headers), for example, big-game.cn-hangzhou.sls.aliyuncs.com.
x-log-apiversion String API version. The current version is 0.6.0.
x-log-bodyrawsize Numeric value Initial size of the request Body. When the request has no Body, the value is 0. When the Body is a compressed data, the value is the size of the initial data before compression. The value range for this field is 0 to 3x1024x1024. This field is optional and needs to be filled only when the Body is compressed.
x-log-compresstype String Compression type of the Body in the API request. Currently, LZ4 and DEFLATE are supported (RFC 1951. For details about the zlib format, refer to RFC 1950). If the Body is not compressed, it is not necessary to provide this request header.
x-log-date String The current time when sent. The format is consistent with that of the Date header. This request header is optional. If a request contains this public request header, this value will replace the standard Date header value in sever request authentication. No matter whether there is an x-log-date header, the standard HTTP Date header must be provided.
x-log-signaturemethod String Signature calculation method. Currently, only hmac-sha1 is supported.
x-acs-security-token String Use the STS temporary identity to send data. It is required only when the STS temporary identity is used to send data.

Note:

  • The maximum difference between the time expressed in a request’s Date header and the time the server receives the request is 15 minutes. If this difference exceeds 15 minutes, the server will reject this request. If the request contains an x-log-date header, the time difference is calculated based on the value of the x-log-date header.
  • If a compression algorithm is specified (in x-log-compresstype) for the request, the initial data needs to be compressed and then put in the HTTP Body. The Content-Length and Content-MD5 header length are calculated based on the size of the compressed Body.
  • When HTTP requests are sent from certain platforms, they cannot specify a Date header (the sending time is specified automatically in the platform’s internal database). Therefore, the correct Date value cannot be used to calculate the request signature. In this case, specify an x-log-date header and use the value of this header for request signature calculation. After receiving an API request, the Log Service server will first determine whether the request contains an x-log-date header. If any, the server uses the header value for signature authentication; otherwise, the server uses the HTTP standard header Sate for signature authentication.
Thank you! We've received your feedback.