Access session storage manager from API action file

Apologies to all if this is really dumb.

I have a series of API calls I have to make on a reciept page from an external payment processor.

The way the system I’m pushing data to is that I have a series of multiple API’s I have to send data to in order (create contract --> Get Contract ID returned --> Pass ContractID in new API call to set the dollar value from the purchase, and so on)

I have all the variables saved as Session Storage (since this helps me keep everything consistent across the multiple page hops I hvae to take out of my system to the CC processor and back again).

My question is have an api action set up that I’ll run through these multiple API’s. . but from there I can’t access the Session Storage variables. I

I tried running it as an app flow in the page but I couldn’t grab any of the output from the previous API to pass to the next one.

Is there anything I’m obviously missing? Or is there any way I can accomplish this. The only think I can think of is to use hidden form fields to grab the Session Variables on page load and then I can access them via linked form in the API but that seems. . .convoluted.

Any thoughts? And again, apologies if I’m being obtuse but I’ve been slamming at this for hours and my brain has gone soft.

Thanks

1 Like

Are your API calls being made from app connect of from server actions?
Remember that sessions set in app connect are browser sessions, those set from server connect are server sessions. They are totally different so you need to clarify

How do we pass a variable stored in the browser side >> Server side?

Generally by $_GET or $_POST. Question is a bit vague.

Sorry about that!

I have another thread here…

Running NodeJS basically have a piece of JS running some code that creates an object, currently I am trying to set a global variable and use that variable after when running a “Server Action”

The object contains JSON Data + Image1 (Base64) + Image2 (Base64) - Had no luck sending it via Server Connect Form as the data appears to be too large or had issues, this is why I am attempting to just store in a Global Variable and pull up the variable when needed on the Server Actions side.

See the function below (i’ve tested 50 different ways in ever way I can think with no luck) and i’ve even tried passing a simple text value to a global variable with no luck as you’ll see in the function. This tells me I am missing a step or syntax somewhere most likley.

<script>
    async function downloadDesignDataFunc() {
    console.log('start timer');
    designDataVar4 = downloadDesignData();
    
    await new Promise(resolve => setTimeout(resolve, 3000));
    console.log('after 4 second');
    dmx.global.data.designDataArray = window.design_data;    
    dmx.global.data.frontDesign = window.design_data[0].image_url;
    dmx.global.data.backDesign = window.design_data[1].image_url;
    console.log(dmx.global.data.designDataArray);
    console.log(dmx.global.data.frontDesign);
    console.log(dmx.global.data.backDesign);
    
    dmx.app.data.content.designDataVar5 = JSON.stringify(dmx.global.data.designDataArray);

    input5.value = dmx.global.data.designDataVar5;

    ds_images = dmx.global.data.designDataVar5;

    dmx.global.data.global_ds_images = dmx.global.data.designDataVar5;

    // global_test_text = "2";

    dmx.global.set('image_data', "4");
    
    dmx.parse("sc_save_design.load({designdatavar3:'" + dmx.app.data.content.designDataVar5 + "'})")
    
    
    // frontImg.value = dmx.global.data.designDataVar3[0].image_url;
    // backImg.value = dmx.global.data.designDataVar3[1].image_url;
    // input5.value = dmx.app.data.content.designDataVar5;
    } 

</script>