Expand my Community achievements bar.

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 !

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

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
}

 

Avatar

Level 2

Hello dhindle, this is brilliant
Thank you very much for your help !