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
Ravi kumar 292Ravi kumar 292 

How to pass the parameters to the Service endpoint URL

Hi all,

I want to pass the Parameters(Status and Amount) to the service endpoint URL. How can i do this. Please help.
Whenever i click on Custom Button i will redirect to the vf page. and call the class.

Below is my code..

VF page:
<apex:page standardController="Lead" extensions="LDController" action="{!CallBack}" >
</apex:page>

Class:

public with sharing class LDController {
    public String LeadId {get;set;}
    
    public LDController(ApexPages.StandardController controller) {
        LeadId=ApexPages.currentPage().getParameters().get('id');
        system.debug('LeadId  '+LeadId);       
    }
    
    public void getAndParse(String POST) {
        String body ='LeadId='+LeadId+'';

        system.debug('------'+body);
        // Get the XML document from the external server
        Http http = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('http://test.com/');
        req.setMethod('POST');
        req.setbody(body);
        HttpResponse res = http.send(req);
        
        String response=res.getBody();
        System.debug('Response '+response);
    }
    public Void CallBack(){
        getAndParse('POST');   
    
    }
   
}

Thanks in advance...
Vijay NagarathinamVijay Nagarathinam
Hi,

Refer the below link you get some idea,

https://developer.salesforce.com/forums/?id=906F0000000BC7CIAW

Thanks,
Vijay