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();
req.setMethod('GET');
req.setEndpoint('https://microsoft-apiapp....azurewebsites.net:443/api/ContactsList');
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!
Thanks!