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
Gaurav AgnihotriGaurav Agnihotri 

Not getting a Jason response from the end point

Hello, 
I am not able to get a Jason response from the end point. http://largesystems.phpwebhosting.com/WQTDev/sf_get_bom.php?quotenum=21660
The only response I am getting back is 
09:40:02:478 USER_DEBUG [20]|DEBUG|System.HttpResponse[Status=OK, StatusCode=200]

However, if I copy/paste the code in the browser address I get a response.
[{"part_quantity":"1","part_number":"D10U-A2-ACC","part_desc":"VX Accessory Svr 2 - DHCP, NTP, Load Balancer","part_unit_msrp":"3543"},{"part_quantity":"10","part_number":"D10U-A2-DEC","part_desc":"VX Enhanced Decoder 2 with Mount, 1 Monitor","part_unit_msrp":"2840"},{"part_quantity":"2","part_number":"A1-KBD-3D-KIT2","part_desc":"VX Enh Keyboard & 3D Mouse Combo. Gen 2.0","part_unit_msrp":"951"},{"part_quantity":"2","part_number":"E1-OPS-WKS","part_desc":"VX Enterprise Workstation, Up to 2 Monitors","part_unit_msrp":"4963"},{"part_quantity":"2","part_number":"E1-OPS-WKS6","part_desc":"VX Enterprise Workstation Up to 6 Monitors","part_unit_msrp":"5622"},{"part_quantity":"1","part_number":"E1-BASE","part_desc":"VX Ent Base Lic with CMG, VXS and 32 Ch Lic","part_unit_msrp":"8667"},{"part_quantity":"4","part_number":"E1-VXS-SW","part_desc":"VX Ent VXS Storage Server Software License","part_unit_msrp":"999"},{"part_quantity":"34","part_number":"E1-32C","part_desc":"VX Ent VXS Storage Channel License - 32 Ch","part_unit_msrp":"8229"},{"part_quantity":"7","part_number":"E1-1C","part_desc":"VX Ent VXS Storage Channel License - 1 Ch","part_unit_msrp":"302"},{"part_quantity":"2","part_number":"KBD5000","part_desc":"ENDURA KEYBRD WITH JOG\/JOY\/KEY","part_unit_msrp":"1920"}]

Below is the simple code: 

 
public class WQTResponse 
{
  public static void Execute()
    {

        string baseURL ='http://largesystems.phpwebhosting.com/WQTDev/sf_get_bom.php?quotenum=21660';
        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setMethod('GET');
        request.setHeader('Accept', 'application/json');
        request.setHeader('Content-Type','application/json');
        
        request.setEndpoint(baseURL);
        
        HttpResponse response = http.send(request);
        
        system.debug(response);
        
        //return(response.getBody());
    }
}

Not sure what I am missing
Ashish KeshariAshish Keshari
Hi Gaurav,
You need to parse the response.getBody() which returns a string. I added a debug statement on the response.getBody()  and below is the output received.
system.debug(response);
	system.debug(response.getBody());

User-added image

Once you received the response body as String - you can refer to my article on how to us JSON2Apex for better processing than to use the JSON parser.
http://ashishkeshari.com/index.php/2017/03/05/using-json2apex-in-salesforce/