locked
The MIME type 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2' requires a '/' character between type and subtype, such as 'text/plain'."}}??? RRS feed

  • Question

  • I'm getting this error message in my response body:

    :{"error":{"code":"ErrorNotAcceptable","message":"The MIME type 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2' requires a '/' character between type and subtype, such as 'text/plain'."}}

    Here's My code:

            Http h = new Http();
    HttpRequest req = new HttpRequest();
            string endPoint = 'https://outlook.office.com/api/v2.0/me/events';
    req.setEndpoint(endPoint);
    req.setHeader('Prefer', 'outlook.body-content-type="text"');
    req.setHeader('Authorization', 'Bearer ' + accessToken);
            req.setMethod('GET');
    HttpResponse response = h.send(req);
            system.debug(response.getBody());

    I have already gotten the access token successfully. I'm not sure why i'm getting this error message.

    Thursday, March 14, 2019 6:20 PM