How to use Environment Variables?

Since the release of Paw 2 in November, I see a lot more of excitement from users, which is an amazing feeling as a developer. There was many bugs to fix in the early versions of Paw 2, so most of the support emails I received where bug reports. Now, it's different, few bugs, more feature requests and also simply questions. It's greatly time for me to start to write some doc! In the meantime, I'll try to post some tips...

Environments let you have some variables that can take different values. An environment is a set of values that the variables can take. For example, your variables would be Port, Host and Protocol, and you would have different values for them for your 2 environments Development and Production.

Create and Edit Environments

The Environment drop down menu is just over the Request List. Hit the button, and Add new environment. Let's call it Development.

Now we can switch to our other environment, and rename it to Production. And assign values to our variables.

Hit OK, and come back to the request.

Use Environment Variables in your requests

In the URL field (or generally, any field), right-click, and you'll find your variables in the context menu under Environment > Environment Variable. Just choose the variable, to insert it in the field.

Now, you can build very flexible requests :)

One more thing, use the Code Inspector (Cmd+Shift+Y to show/hide) and pick HTTP to preview how the request has been generated.