I am attempting to do a very simple test connection between Salesforce Apex and my Azure API App. I followed the tutorial to create the API App and I can access and use it via the URL just fine.

When I attempt to connect to it from an Apex class, I receive Status=Internal Server Error, StatusCode=500 as the response, with a body of:

    "status": 500,
    "source": "https://default-web-....azurewebsites.net/api/ContactsList,
    "message": "The format of value '*; q=.2, */*; q=.2' is invalid."

This is the code of the class:

public class APITest {
public static void Attempt(){
    HttpRequest req = new HttpRequest();
    Http http = new Http();


    HTTPResponse resp = http.send(req);
    System.debug(LoggingLevel.INFO, resp.getBody());

I have the https://microsoft-apiapp....azurewebsites.net set up in Remote Site settings.

Is there anything I'm missing? My goal is to get an XML response from the API. Any help would be appreciated!


  • Missing headers, authentication, etc?
    – Eric
    Jul 30, 2015 at 21:50

1 Answer 1


Q values have to do with the service negotiation headers (the Accept and Accept-* headers). Microsoft Azure is stating that an Accept header was provided:

Accept: *; q=.2, */*; q=.2

And that this value wasn't valid. As your code snippet doesn't include that, I can imagine that Salesforce is providing some default value, and that default value isn't something Azure likes (note: the specs give examples like q=0.2, suggesting that the integral portion of the q factor should be present).

You can try explicitly setting a value:

req.setHeader('Accept', '*/*; q=1');

I'm not sure if that will fix the problem, but that's the best suggestion I have for you at this moment.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .