function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.setMethod('POST');
        req.setEndpoint(loginUri);
        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);
        System.debug('RESPONSEEEEEEEEEEEEEEEEEEe'+res.getBody());

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 !