HTTP Content-Type and Accept headers

With a PUT or POST request, you use the HTTP Content-Type request header to specify the format in which you’re providing the request body.

With a GET request, you can use the HTTP Accept request header to specify the format for the response body. If you omit this header, the API returns the response body in XML format.

In a Content-Type or Accept header, you specify the input or output format as an Internet media type:

For XML, the Internet media type is application/xml.

For JSON, the Internet media type is application/json.

For JSON with callback, the Internet media type is application/javascript.

For CSV, the Internet media type is text/csv.

You don’t need to specify a Internet media type in an OPTIONS request. If you do specify one, it is ignored.

With cURL, you use the -H option to specify an HTTP header. So, for example, to specify that a request body uses XML, you would include this in the curl command:

-H "Content-Type: application/xml"

In Python with PycURL, you do this with the HTTPHEADER option. For example:

curl.setopt(pycurl.HTTPHEADER, ["Content-Type: application/xml"])

HTTP headers and Internet media types are not case sensitive.

Trademark and LegalDisclaimer

© 2015 Hitachi Data Systems Corporation. All rights reserved.