Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Cue the extraordinary. Show-stopping experiences that raise the digital bar. Apply now for the 2023 Adobe Experience Maker Awards.
SOLVED

Adobe IO - Fetch post call and return response back from external endpoint

Avatar

Level 2

In adobe IO action I need to fetch data from an external endpoint and return the response back to campaign standard,

I need help on this one,

Thank you !

1 Accepted Solution

Avatar

Correct answer by
Level 2

have you tried

params['__ow_headers']

View solution in original post

6 Replies

Avatar

Level 2

Hi El-Coder,

 

What do you need help with?

 

  1. Are you unable to create an IO action / endpoint?
  2. Are you unable to connect to the external endpoint?
  3. Are you unable to sent data to Adobe Campaign?

I need more information to be able to help you.

 

Regards,

Avatar

Level 2

Hi,

Yes all is in place ,

I’m asking if there’s any way to get the headers data from the system that’s calling the action I’ve created.

I succeeded retrieving the payload data but still struggling to get headers data 😓

thank you for your help.

 

Avatar

Correct answer by
Level 2

have you tried

params['__ow_headers']

Avatar

Level 2

Hello dhindle,

Thank you very much for your help, I have managed to get the header data,
I am trying to use the headers and payload data and to do this I usually use this in the function parameters, but the function does not work when I use two parameters in it:

Working : async function functionName(params)
Working : async function functionName(payload)
Not Working : async function functionName(params,payload)


Thank you for your advice.

 

Avatar

Level 2

Correct

async function functionName(payload) <-- here you are just renaming `params` to `payload`. The contents are still the same, payload and headers.

 

If you debug params what attributes do you see? I think you can just filter out anything that starts with `__ow_`

Something like this:

/**
 *
 * Returns the parameters without `__ow` attributes.
 *
 * @param {object} params action input parameters.
 *
 * @returns {object}
 *
 */
function getStrippedParams(params) {
  let cleanedParams = {}

  for (const attr in params) {
    if (!attr.startsWith('__ow'))
      cleanedParams[attr] = params[attr]
  }

  return cleanedParams
}

 

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now