Spanish Total.js
English
Documentation For AI agents
Contents

Use a value of an answer in other requests

A request can take a value from its answer and keep it in a variable: the token after signing in, or the identifier of what it made.

.md GitHub
On this page

Keep the value

  1. Open the tab Checks of the request that gets the value.
  2. Under Keep in variables, press + Keep a value.
  3. On the left, write where the value is.
  4. On the right, write the name of the variable, without braces.

Each time you send the request and an answer comes, the variable has the new value. The tab Checks of the answer shows it under Kept in variables.

Say where the value is

WriteTo take
tokenThat value of the JSON
value.tokenA value inside another
items[0].idThe id of the first one of a list
header:x-tokenA header of the answer

A value that is not in the answer changes nothing: the variable stays as it was.

Where it is kept

The value goes to the environment that you are using. If the variable is there, it keeps being secret or not, as you left it. If it is not, TotalAPI adds it, and makes it secret when its name has token, password, secret or key.

Any other new variable is written in the file of the collection. If the value is private, add the variable first and mark Secret.

An example

  1. The request Sign in keeps value.token in token.
  2. The request My orders has {{token}} as its Bearer token.
  3. Send the first, then the second. When the token ends, send the first again.

It works also when you run the requests one after another.

Made in Europe