• vineesha podugu 7
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
I am trying to make a callout in salesforce , then I am getting response as 404 not found. when i am doing the same thing in Postman I am getting the response.

could any one suggest where i am going wrong.

here is my class:
public class housingcallout {
    @future(callout=true)
    public static void sendhousingCalloutREST(){
        Housing_creds__c data = Housing_creds__c.getvalues('housingcreds'); 
        Hash_Code__c data1 = Hash_Code__c.getvalues('hashcreds'); 
        Manditory_Fields__c data2 = Manditory_Fields__c.getvalues('Hard Coded Fields');
        lead CreateLead = new lead();
        list<lead> newLeads = new list<lead>();
        DateTime Yesterday = DateTime.now()-1;
        HousingWrapper JsonRec = new HousingWrapper();
        JsonRec.start_date = ''+Yesterday.getTime()/1000;
        JsonRec.hash = data1.Hash__c;
        JsonRec.end_date = data2.end_date__c;
        JsonRec.current_time = data1.Current_time__c;
        JsonRec.id = data2.Param_Id__c;
        JSONGenerator gen = JSON.createGenerator(true);
        gen.writestartobject();
        gen.writeStringField('start_date', JsonRec.start_date);
        gen.writeStringField('end_date', JsonRec.end_date);
        gen.writeStringField('current_time', JsonRec.current_time);
        gen.writeStringField('hash', JsonRec.hash);
        gen.writeStringField('id', JsonRec.id);
        gen.writeEndObject();
        try{
            String endPointURL = data.url__c;
            String userName = data.username__c;
            String password = data.password__c;
            
            // Specify the required user name and password to access the endpoint 
            // As well as the header and header information 
            Blob headerValue = Blob.valueOf(userName + ':' + password);
            String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
            Httprequest request = new HttpRequest();
            Http http = new Http();
            request.setMethod('GET');
            request.setEndpoint(endPointURL);
            request.setHeader('Content-Type', 'application/json');
            // Header info with remote server user name and password
            request.setHeader('Authorization', authorizationHeader);
            // timeout in milliseconds       
            //request.setTimeout(120000); 
            string jsonString = gen.getAsString();
            system.debug('string '+jsonString);
            request.setBody(jsonString);              
            system.debug('request' + request);
            //Making call to external REST API
            HttpResponse response = http.send(request);
            system.debug('status code '+response.getStatusCode());
            if(response.getStatusCode() == 200){
                list<leadsuccessWrapper> LeadList = new list<leadsuccessWrapper>();
                LeadList = (list<leadsuccessWrapper>)system.json.deserialize(response.getBody(), list<leadsuccessWrapper>.class);
                System.debug('responseBody: '+response.getBody());
                for(leadsuccessWrapper LeadAssign:LeadList){
                    CreateLead.ProjectSelectedDate__c = datetime.newInstance(LeadAssign.lead_date*1000);
                    CreateLead.LastName = LeadAssign.lead_name;
                    CreateLead.Email = LeadAssign.lead_email;
                    CreateLead.Phone = LeadAssign.lead_phone;
                    CreateLead.CountryCode = LeadAssign.country_code;
                    CreateLead.Project_id__c = LeadAssign.project_id;
                    CreateLead.Portal_Project_Name__c = LeadAssign.project_name;
                    CreateLead.Project_Location__c = LeadAssign.locality_name;
                    CreateLead.City = LeadAssign.city_name;
                    CreateLead.Status = data2.Enquiry_Status__c;
                    CreateLead.EnquirySubSource__c = data2.Enquiry_Source__c;
                    newLeads.add(CreateLead);
                }
                if(newLeads.size()!=0)
                    insert newLeads;
            }
        }catch(Exception e){
            System.debug('Error::'+e.getMessage());
        }
    }
    public class HousingWrapper {
        public string Start_date;
        public string end_date;
        public string current_time;
        public string id;
        public string hash;
    }
    public class leadsuccessWrapper{
        public integer lead_date;
        public String lead_name;
        public String lead_email;
        public String lead_phone;
        public String country_code;
        public string project_id;
        public String project_name;
        public String locality_name;
        public String city_name;   
    }
}
 
Create a class called 'ParkLocator' that has a 'country' method that uses the 'ParkService' class and returns an array of available park names for a particular country passed to the web service. Possible country names that can be passed to the web service include Germany, India, Japan and United States.

i have used the ParkLocator.. but i am getting an error that "The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint."

could any one help me plz....
Hi All,
I am trying to do Trailhead module about Heroku Connect module 
The application's server.js file in the root directory contains the server-side Node.js application. If you edit that file, you see the SQL statement used to update the database:UPDATE salesforce.Contact SET Phone = $1, MobilePhone = $1 WHERE ...
I couldn't find any such file containing the UPDATE salesforce.Contact SET Phone = $1, MobilePhone = $1 WHERE ... 
 please help
Create a class called 'ParkLocator' that has a 'country' method that uses the 'ParkService' class and returns an array of available park names for a particular country passed to the web service. Possible country names that can be passed to the web service include Germany, India, Japan and United States.

i have used the ParkLocator.. but i am getting an error that "The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint."

could any one help me plz....
Hi All,
I am trying to do Trailhead module about Heroku Connect module 
The application's server.js file in the root directory contains the server-side Node.js application. If you edit that file, you see the SQL statement used to update the database:UPDATE salesforce.Contact SET Phone = $1, MobilePhone = $1 WHERE ...
I couldn't find any such file containing the UPDATE salesforce.Contact SET Phone = $1, MobilePhone = $1 WHERE ... 
 please help
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG