Jak definovat proměnné v api

Příklady kódu

2
0

proměnné prostředí pošťáka

pm.environment.set("variable_key", "variable_value");
1
0

API proměnné prostředí

Environment Variable , a variable that accessible
only when the environment is active 

Usually used for an app with multiple environment ,
we can use env variable to store variable with same name
and different value to store environment specific data 

for example : 

xxxNamed app has 3 environments with different
URL and Crendentials 

But all endpoints are exactly the same no matter what
environment you work on 

so we can create 3 environment called 
QA1 , QA2 , QA3 and run same set of request 
by selecting different environment.

Only one environment can be active at a time.
1
0

jak definovat proměnné v api

-Use pm.globals to define a global variable:

pm.globals.set("variable_key", "variable_value");

-Use pm.collectionVariables to
define a collection variable:

pm.collectionVariables.set("variable_key", "variable_value");

-Use pm.environment to define an environment
variable (in the currently selected environment):

pm.environment.set("variable_key", "variable_value");

-You can use unset to remove a variable:
pm.environment.unset("variable_key");

-Defining local variables
Local variables are temporary values you set
in your request scripts using the following syntax:

pm.variables.set("variable_key", "variable_value");
0
0

datová proměnná api

Data variables come from external CSV and JSON files
to define data sets you can use when running collections
via the Collection Runner.
0
0

kolekce proměnných pošťák

Only accessible within the same collection and
can not be accessed anywhere else
COLLECTION variables are available throughout 
the requests in a collection and are independent
of environments, so do not change based on the selected environment.
I use collection variables when
I use single environment like url details.
We can refer to the variable by using {{}}(double curly brace)
and  it can be used anywhere

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................