DEV Community

Roman Vladimirov
Roman Vladimirov

Posted on

Running HTTP(s) queries every day with ArdorQuery: Part 6 global variables

If you're currently developing a web application, it's highly likely that you have an API, be it a REST API, a GraphQL API, or any other API. This means that HTTP queries must be made daily for development and testing. There are a huge number of tools available for running HTTP queries, such as cURL and Postman etc. I would like to tell you about a tool that I made for myself, but it might be useful for you too, it's called ArdorQuery. In this article, you will learn how to use the ArdorQuery application on a daily basis to make HTTP queries. The application is oriented on keyboard and allows you to separate parts of your query as human-readable lines. Lines are highlighted in different colors depending on the type of content. To get more information about application and install.

Previous post describing the use of multiple queries

So, we have already learned how to create and execute queries, but it often happens that a query consists of parts that are repeated quite often. For example, if authorization in a REST API is based on a token, then most requests require passing a token. Adding a token to each request can be quite tedious, but let's say I created ten requests and added all the tokens to them, but then I had to work with a different token, which means I need to open all ten requests and change the token manually. This is very inconvenient, so you can use another way and define global variables.
To open the global variables window press Ctrl-F6.
Empty Window
Working with this window is similar as we do in editing query. Let's create a new global variable, to add a new variable press Ctrl-Enter. Next, enter apitoken mytokencontent in the empty line. The format of the global variable <variable name> <value>.
Added token
After we done with editing global variables need to save it and for this press Ctrl-S. To move through line, you can use PgDown and PgUp (also Ctrl-PgDown to the end and Ctrl-PgUp to the beginning).
After this, you can add a global variable to any value of any field like this {{<variable name>}}, in our case it will be {{apitoken}}. Now we can add the bearer {{apitoken}} header to several requests, and if in the future we need to replace it in all requests at once, it will be enough to change its value through the Global Variables window.
Using in query

Top comments (0)