Should I use path variables in the Imgur API?

Hello, :grinning:

I’m a bit confused. Well, I play with the Imgur API. Everything works as it should, but I’m not sure if I’m creating a request according to best practices. Well, in the API documentation - Imgur API

to GET a specific image you need to send such an endpoint:{{imageHash}}

under {{imageHash}} we substitute a specific id and everything works:

but I noticed that in postman you can also use path variables so instead of {{imageHash}} we can give, for example, such an endpoint:

and in the path variable under id insert the value. This also works fine.

Now the question is: which of these methods is better? Should I stick to the documentation of the specific API and not add path variables when it is not clearly written?

I would be very grateful if someone would answer my question

Have a nice day, guys :slight_smile:

They both do the same thing. Your first example is also using a path (to the image), not a query.

I guess it would be down to scope.

Using the second method sticks the path variable in the request. It will be the same ID each time the request is run.

Using the first method allows you to use collection or environment variables which may be set by a pre-request script or from the response of a previous request.

1 Like

Thank you for your response.

I know both methods work the same, but let’s assume we have a scenario like this:

Every time we request a new image with a different id, which of the two methods would be better in this scenario?

Suppose we have images with these IDs:

  1. OHmyt2E
  2. QsTedsW

better would be to send endpoints for each request like this:


or using the second method like this:

(post deleted by author)

Your example is showing the same request, but with different data.

In my opinion, you would parameterise the ID element of the URL using an environment or collection variable.

You would then create a single data driven test\request which reads those image IDs from a CSV file. A data driven test will then run the same request for each line in the CSV.

I guess this is down to what you are actually trying to test. Individual requests with each ID might be fine.

However, I’m not really seeing the benefit of using the path variable here, you might as well just have the URL with the ID on it.

My understanding is that path variables are best practice when developing API’s, so that is why this feature is here, to replicate what would eventually end up in code.