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
but I noticed that in postman you can also use path variables so instead of {{imageHash}} we can give, for example, such an endpoint: https://api.imgur.com/3/image/:id
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
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.
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.