Running HTTP(s) queries every day with ArdorQuery: Part 4 routes and URL parameters
Roman Vladimirov
Posted on November 7, 2023
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 or download. In this part, we will discuss how to work with routes and URL parameters.
A URL path is an integral part of an HTTP request that acts as a path to the desired destination. This applies to both the path described in the manner of folders on the local disk separated by the symbols / (for example /building1/room1/Alice/apple
) and additional parameters after the path listed after the symbol ? (like ?color=green&size=large
). Both the path and the parameters are described by one continuous line. If the path is long and/or there are many parameters, the one-line representation is not always easy to read. In the application, you can split both the path and parameters into separate lines.
Let's say we have a URL https://mysite.com/products/tablet/product/1?company=samsung&monitorsize=8
. Here we choose
for a user with id=1
from the products
of a certain store, a product with a category tablet
and a filter by company samsung
with a monitor size of 8
inches.
Let's now add this URL to the application url https://mysite.com/products/{category}/product/{userid}
.
As you can see, we have replaced the category
and userid
with named parameters ({category} and {userid}). Named parameters are defined in the format {parameter name}.
Next you need to add values for the named parameters. To do this, add a line with the content route category=tablet
and another line with the content route userid=1
. This way, if we need to change part of route for a category
or userid
, we can do it on separate lines with a clear name, which is more convenient than doing it in the query string itself.
We forgot something, what about URL parameters? To define them, we add two more lines: param сompany=samsung
and param monitorsize=8
. If you perform query you will see that we've make query with same URL as in the original form, but now we can change both routes and the URL parameters separately in a more readable form.
Posted on November 7, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.