2.2.2.2 Common Response Format
The common server response across all endpoints used in this protocol has one of the following formats, depending on whether the response is chunked.
Non-chunked response:
-
HTTP/1.1 200 OK Content-Length: <length of META-TAGS, ADDITIONAL HEADERS and RESPONSE BODY> Content-Type: application/mapi-http X-RequestType: <?> X-ResponseCode: <?> X-RequestId: <?> X-ServerApplication:<server version> <META-TAGS> <ADDITIONAL HEADERS> <RESPONSE BODY>
Chunked response:
-
HTTP/1.1 200 OK Transfer-Encoding: chunked Content-Type: application/mapi-http X-RequestType: <?> X-ResponseCode: <?> X-RequestId: <?> X-ServerApplication:<server version> <META-TAGS> <ADDITIONAL HEADERS> <RESPONSE BODY>
The first line of all server responses begins with the POST method response specified in [RFC2616], "HTTP/1.1". It also contains an HTTP status code, as described in this section.
Both non-chunked and chunked responses MUST contain the following headers:
Content-Type, specified in section 2.2.3.2.2
X-RequestType, specified in section 2.2.3.3.1
X-ResponseCode, specified in section 2.2.3.3.3
X-RequestId, specified in section 2.2.3.3.2
In addition to these headers, a non-chunked response contains the Content-Length header, specified in section 2.2.3.2.1, and a chunked response contains the Transfer-Encoding header, specified in section 2.2.3.2.5.
The server returns a "200 OK" HTTP status code even if the request failed for all non-exceptional failures. The server deviates from a "200 OK" HTTP status code only for authentication ("401 Access Denied"), redirection ("302 Redirect"), or if there is some exceptional condition for which the server cannot continue. Exceptional failures will produce a "500 Internal Server Error" status code or other 5xx-level status codes. For more details about the status codes, see [RFC2616] section 10.
For success or non-exceptional conditions (most failures), the server will return "200 OK" and an X-ResponseCode header. This header contains a numerical value that indicates the specific failure that occurred on the server. An X-ResponseCode of 0 (zero) means success from the perspective of the protocol transport, and the client parses the RESPONSE BODY based on the request that was issued. If the X-ResponseCode is not zero, the server populates the RESPONSE BODY with diagnostic information.