Skip to main content
Version: v111

Handling responses

All Execute{Method}Async functions return an instance of RestResponse. Similarly, Execute{Method}Async<T> return a generic instance of RestResponse<T> where T is the response object type.

Response object contains the following properties:

PropertyTypeDescription
RequestRestRequestRequest instance that was used to get the response.
ContentTypestring?Response content type. Null if response has no content.
ContentLengthlong?Response content length. Null if response has no content.
ContentEncodingICollection<string>Content encoding collection. Empty if response has no content.
Contentstring?Response content as string. Null if response has no content.
IsSuccessfulStatusCodeboolIndicates if response was successful, so no errors were reported by the server. Note that 404 response code means success.
ResponseStatusNone, Completed, Error, TimedOut, AbortedResponse completion status. Note that completed responses might still return errors.
IsSuccessfulboolTrue when IsSuccessfulStatusCode is true and ResponseStatus is Completed.
StatusDescriptionstring?Response status description, if available.
RawBytesbyte[]?Response content as byte array. Null if response has no content.
ResponseUriUri?URI of the response, which might be different from request URI in case of redirects.
Serverstring?Server header value of the response.
CookiesCookieCollection?Collection of cookies received with the response, if any.
HeadersCollection of HeaderParameterResponse headers.
ContentHeadersCollection of HeaderParameterResponse content headers.
ErrorMessagestring?Transport or another non-HTTP error generated while attempting request.
ErrorExceptionException?Exception thrown when executing the request, if any.
VersionVersion?HTTP protocol version of the request.
RootElementstring?Root element of the serialized response content, only works if deserializer supports it.

In addition, RestResponse<T> has one additional property:

PropertyTypeDescription
DataT?Deserialized response object. Null if there's no content in the response, deserializer failed to understand the response content, or if request failed.