+ Start a Discussion
College ManagementCollege Management 

JSON Html reponse while integrating salesforce to quickbook.

Hi, I am trying to integrate salesforce to quickbook , while executing the class i am getting STATUS : OK STATUS_CODE : 200 , Expected JSON response but i am getting html as a response.

        HttpRequest req = new HttpRequest();
        req.setBody("Here i am passing some arguments");
        req.setHeader('Accept', 'application/json;charset=UTF-8');
        Http http = new Http();
        HTTPResponse res = http.send(req);

Thanks !
James LoghryJames Loghry
It's difficult to know what the issue is without knowing about the webservice you're calling.

The HTML response is likely an error condition due to the web service not being called correctly.

If you use Chrome, try downloading the "REST Console" plugin and issuing the same request with the plugin.  At the very least, you'll know it's some issue with calling the webservice, and then you can easily tweak your request to fix it.  

Furthermore, I'd try getting ahold of the web service developer or looking closely through any documentation for troubleshooting tips.

Good luck.
College ManagementCollege Management
Thanks for ur quick response.  But I am getting the System.HttpResponse[Status=OK, StatusCode=200] while debugging response( ie., System.debug('****************'+res) which says the request is successful.  I am confused with the stuff. And finally due to that html response i am getting an error in debug saying ERROR : "A JSONObject text must begin with { ".

Thanks !