The management framework defines Content Type to indicate the format of management requests and responses. Clients can dictate the content type of the management request by specifying the
Accept and Content-Type headers of the HTTP request. The Accept header indicates the format of the response and the Content-Type header specifies the format of the request. Below is a list of request headers that map to the Content Type of the management system.
|
Header
|
Content Type
|
|---|---|
|
application/json
|
JSON
|
|
application/xml
|
XML
|
|
application/zip
|
ZIP
|
Note
JSON is the default content type.
To make it easy to control the content type of management requests through the browser, the REST component supports the
format HTTP parameter to dictate the format of the response. This is because most browsers already send an 'Accept' header.
Example 2.8. Specifying the response should be returned as XML
http://localhost:8080/rest/private/managed-components/foo/bar?format=xml
Below is the list of
format HTTP parameters which map to Content Types.
|
Format parameter
|
Content Type
|
|---|---|
|
format=json (default)
|
JSON
|
|
format=xml
|
XML
|
Important
Content negotiation is ignored for content type specific operations such as
read-config-as-xml and export-resource since these cannot return different formats.