How to Use Variables in Postman

Поделиться
HTML-код
  • Опубликовано: 1 авг 2024
  • Variables allow you to store and reuse values in your requests and scripts.
    Try it yourself: www.postman.com/devrel/worksp...
    Learn more: learning.postman.com/docs/sen...
    00:00 - Start
    00:20 - Variable Scopes
    01:58 - How to re-use values using variables
    03:52 - How to hide sensitive data using variables
    05:48 - How to update values on the fly using variables
    08:00 - How to loop over values from a file using variables
  • НаукаНаука

Комментарии • 12

  • @cjchand
    @cjchand 3 месяца назад

    Excellent overview of Postman variable types and scopes. Truly appreciate the relevant examples used. This is perfect to help educate my users on the right way to manage secrets. Thanks!

  • @45632476
    @45632476 2 года назад

    Thank you for a clear explanation. I've expanded my instruments now with "values".

  • @7bagette
    @7bagette Год назад

    Running with a data file was game changer, thank you!

  • @markussiebeneick4075
    @markussiebeneick4075 2 года назад

    In the how to hide sensitive data section, by replacing Initial value with Enter API Key Here, should you instead say Add API Key in Current Value?

    • @postman
      @postman  2 года назад

      If used in "Current Value" then the collection would be pulling that text instead of the API Key and therefore the authentication would fail. Replacing the initial value with "add your api key as the current value" would be a good alternative here.

  • @fabioquixada2316
    @fabioquixada2316 Год назад

    Niiiiice!!!

  • @alexr7289
    @alexr7289 Год назад

    Is there a way to view the variables used in the API call in the summary screen without having to drill into the call ie show it on the POST line.

    • @postman
      @postman  Год назад

      Hey Alex, if you hover over the variable you'll see what it's resolving to.

  • @jp-uno
    @jp-uno Год назад

    your example didn't work at 7:25 because it wasn't an integer. How to set to set the variable as an integer?

    • @postman
      @postman  Год назад +1

      You can either save the value as an integer instead of string. Or you can cast the value to an integer by using the JavaScript method `parseInt()`.

  • @shirishcin
    @shirishcin Год назад

    difference between int variable and string variable ? how can we declare those ? any difference "{{name}}" and for int as {{idnum}}

    • @postman
      @postman  Год назад

      Postman stores variables as strings. If you want to use an integer variable in a script, you can cast `idnum` to an integer data type, such as `parseInt(idnum)`.