The documentation tells us that XML, however un-hip, can be used as a request format.

The reality seems to be only HTTP 415 errors with UNSUPPORTED_MEDIA_TYPE.


global class ZREST {

    global static string doPost(string obj) {
      return 'OK: '+obj;


POST https://cs8.salesforce.com/services/apexrest/zrest.xml HTTP/1.0
content-length: 37
accept: text/xml
content-type: text/xml
authorization: OAuth ***
user-agent: Whateva
host: cs8.salesforce.com
accept-encoding: gzip



<?xml version="1.0" encoding="UTF-8"?>
        <message>Content-Type header specified in HTTP request is not supported: text/xml; charset=UTF-8</message>

Needless to say it works fine with application/json and {"obj" : "A"}!

  • Did you solve this? I think the 'OK: ' is the problem. Did you try with @HttpPost global static string doPost(string obj) { return obj; } – Acuariano Dec 27 '14 at 21:00

try: Accept: application/xml in your request header.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.