Working a poc on integrating Salesforce with Eventbrite. Want to have events created in Salesforce which automatically get created on eventbrite.
What do I do so that events gets created on eventbrite? Can you please help me with the sample code to proceed
This is what I am referring to https://www.eventbrite.com/developer/v3/
public class EventbriteCallBackController {
Callbacktoken__c cfg = new Callbacktoken__c(SetupOwnerId = UserInfo.getUserId());
public void insertsettings() {
insert cfg;
}
public EventbriteCallBackController(){
String clientId = 'JSU646Y57T4RZ722ZP'; // Set this in step 3
String clientSecret = '7F4LQ24WGPVULZPHPXNZP6CIWVUC7H5RXFTMZOSDAFAYDVPKYP'; // Set this in step 3
String paramCode = ApexPages.currentPage().getParameters().get('code');
system.debug('paramCode '+paramCode);
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://www.eventbrite.com/oauth/token');
String body = 'code='+paramCode+'&client_secret='+clientSecret+'&client_id='+clientId+'&grant_type=authorization_code';
req.setMethod('POST');
req.setBody(body);
req.setHeader('Content-Type','application/x-www-form-urlencoded');
System.debug('Request is' +req);
HttpResponse res = new HttpResponse();
System.debug('response is' +res.getBody());
Http h1 = new Http();
HttpResponse res2 = h1.send(req);
String resp = res2.getBody();
System.debug('FINAL RESP IS:'+EncodingUtil.urlDecode(resp, 'UTF-8'));
Map<string,object > results =(Map<string,object>)Json.deserializeuntyped(resp);
cfg.access_token__c = (string)results.get('access_token');
}