Actually I'm doing Adobe connect integration with Salesforce.For that I wrote the REST api that works perfectly but here the problem is for every time i'm checking the cookie value is changed , so how to maintain the cookie values in apex class.

if anybody having idea please help me

This is my REST class:

global class LeadExportToAdobe{

    @future (callout=true)
    global static void exportLead(String username, String password, String endpointUrl,String LastName,String Email){

        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.setHeader('Content-Type', 'application/json');

            res = http.send(req);
            System.debug('MyResult == :'+res.getBody());

        } catch(System.CalloutException e){

            System.debug('Callout error: '+ e);

1 Answer 1


Rather than storing and retrieving from cookies, leverage Platform Cache

With this, use Cache.Session methods.


Storing value in session cache:

Cache.Session.put('local.myPartition.firstname', firstName);

Retrieving values from cache:

String firstName = (String) Cache.Session.get('local.myPartition.firstname');

Note that, Cache.Session.get always returns Object type, so you need to typecast it to desired datatype.

  • Is it possible to access the session cache set in User's session inside the @future callout method which is called from that same User's session?
    – Mohan P
    Commented Jan 16, 2020 at 20:12

You must log in to answer this question.