The Cloud Servers API supports both the JSON and XML data serialization formats. The request format is specified using the Content-Type header and is required for operations that have a request body. The response format can be specified in requests using either the Accept header or adding an .xml or .json extension to the request URI. Note that it is possible for a response to be serialized using a format different from the request (see example below). If no response format is specified, JSON is the default. If conflicting formats are specified using both an Accept header and a query extension, the query extension takes precedence.

Table 3.1. JSON and XML Response Formats
Format Accept Header Query Extension Default
JSON application/json .json Yes
XML application/xml .xml No


Notice, in the above example, that the content type is set to application/json but application/xml is requested via the Accept header. An alternative method of achieving the same result is illustrated below – this time we utilize a URI extension instead of an Accept header.