How to ser exported variables globally available

Hi,
I’m authenticating and exporting the auth-key and it’s being set available within its steps.
for instance,

  • id: “AgentApis”
    steps:
    .
    .
    .
    export:
    auth_token: “response.body.jsonresponse.token”

and I can access it as authenticate.auth_token, But I need them globally across all steps and transactions.

Hi,

You can do this with YAML aliases:

- id: transaction-one
  steps:
    - &auth-step
      id: auth
      request:
      ...
      export:
        auth_token: “response.body.jsonresponse.token”

- id: transaction-two
  steps:
    - *auth-step

This is essentially adding the step to every transaction but you don’t have to copy it each time.

Hi,
Thanks for the reply, but this process will happen each time right?
What If i need some other data from a response to be used as a parameter for another API which inturn is within some other transaction?

Hey,

Unfortunately, at this time you can not globally export data from responses. It will only be available in the transaction it belongs to, or using an YAML alias you’ll make one request per transaction you alias it to.

Can you please let us know what is the use case you need it for?

1 Like

thanks for the help.