You need to sign in to do that
Don't have an account?
![basha sk basha sk](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
How to maintain Session through apex REST API ?
Hi Everyone,
Apex class :
------------
here at endpoint for everytime i'm generating the session value and passing statically.
req.setEndpoint(url+'/api/xml?action=report-my-events&account-id=1309160790&&session=apac1breez6wnxuiam7asee4hw');
session=apac1breez6wnxuiam7asee4hw this value i'm passing statically for everytime.Instead of that how to maintain the session
through apex class.
global class AdobeConnectEvents{
@future (callout=true)
global static void getParticipants(String username, String password,String url){
Http http = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' +
EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
req.setEndpoint(url+'/api/xml?action=report-my-events&account-id=1309160790&&session=apac1breez6wnxuiam7asee4hw');
req.setMethod('GET');
req.setHeader('Content-Type', 'application/json');
req.setHeader('Accept','application/json');
try {
res = http.send(req);
System.debug('MyResult == :'+res.getBody());
}catch(System.CalloutException e){
System.debug('Callout error: '+ e);
}//return res;
}
}
Thanks In Advance,
Basha