+ Start a Discussion
Sean NolansSean Nolans 

generate url for zapier connection to SFDC

I wish to generate a URL in order to pass data from a thrid party connctor (Zapier) to SFDC. Does anyone know how I could generate such a URl from SFDC that could be query a REST API endpoint ?

https://zapier.com/help/how-get-started-webhooks-zapier/#using-the-retrieve-poll-trigger-option

The would be used to listne for changes in another application ?

thanks



 
Best Answer chosen by Sean Nolans
Manish  ChoudhariManish Choudhari
Hi Derek,

You want to make a callout, right? If yes, below is sample rest callout code:
 
HttpRequest req = new HttpRequest(); 
 
  //Set HTTPRequest Method
  req.setMethod('PUT');

  //Set HTTPRequest header properties
  req.setHeader('content-type', 'image/gif');
  req.setHeader('Content-Length','1024');
  req.setHeader('Host','s3.amazonaws.com');
  req.setHeader('Connection','keep-alive');
  req.setEndpoint( this.serviceEndPoint + this.bucket +'/' + this.key); // you should give your endpoit url here along with the key
  req.setHeader('Date',getDateString()); 

  //Set the HTTPRequest body	
  req.setBody(body); 	

  Http http = new Http();
  
   try {
 
        //Execute web service call here		
        HTTPResponse res = http.send(req);	

        //Helpful debug messages
        System.debug(res.toString());
        System.debug('STATUS:'+res.getStatus());
        System.debug('STATUS_CODE:'+res.getStatusCode());
		
} catch(System.CalloutException e) {
	//Exception handling goes here....
}

There is a wonderful trailhead module covering this topic, check out here:
https://trailhead.salesforce.com/en/modules/apex_integration_services/units/apex_integration_rest_callouts




Please mark this as best answer if this answers your query.
Check my online presence here: 
My Blog: http://sfdcfacts.com/
Youtube Channel: https://www.youtube.com/SFDCFacts
LinkedIn: https://www.linkedin.com/in/manish-choudhary/
Trailhead: https://trailhead.salesforce.com/en/me/manish-choudhari
Twitter: https://mobile.twitter.com/manish_sfdc

All Answers

Manish  ChoudhariManish Choudhari
Hi Derek,

You want to make a callout, right? If yes, below is sample rest callout code:
 
HttpRequest req = new HttpRequest(); 
 
  //Set HTTPRequest Method
  req.setMethod('PUT');

  //Set HTTPRequest header properties
  req.setHeader('content-type', 'image/gif');
  req.setHeader('Content-Length','1024');
  req.setHeader('Host','s3.amazonaws.com');
  req.setHeader('Connection','keep-alive');
  req.setEndpoint( this.serviceEndPoint + this.bucket +'/' + this.key); // you should give your endpoit url here along with the key
  req.setHeader('Date',getDateString()); 

  //Set the HTTPRequest body	
  req.setBody(body); 	

  Http http = new Http();
  
   try {
 
        //Execute web service call here		
        HTTPResponse res = http.send(req);	

        //Helpful debug messages
        System.debug(res.toString());
        System.debug('STATUS:'+res.getStatus());
        System.debug('STATUS_CODE:'+res.getStatusCode());
		
} catch(System.CalloutException e) {
	//Exception handling goes here....
}

There is a wonderful trailhead module covering this topic, check out here:
https://trailhead.salesforce.com/en/modules/apex_integration_services/units/apex_integration_rest_callouts




Please mark this as best answer if this answers your query.
Check my online presence here: 
My Blog: http://sfdcfacts.com/
Youtube Channel: https://www.youtube.com/SFDCFacts
LinkedIn: https://www.linkedin.com/in/manish-choudhary/
Trailhead: https://trailhead.salesforce.com/en/me/manish-choudhari
Twitter: https://mobile.twitter.com/manish_sfdc
This was selected as the best answer
Sean NolansSean Nolans
This helps a lot thank you for this