Resurnix
Resurnix

Reputation: 23

How to send GET requests with variable path parameters in JMeter?

I'm using JMeter to load test our APIs via GET requests. We currently have the endpoints set up to use path parameters instead of query parameters (I realize that's not best practice, but that's another discussion).

I can't figure out how I can set up the HTTP requests to use path parameters without "hardcoding" them into the Path field.

For example, one of our endpoints is https:servername.com/geolocations/locations/lat/long. An example call would be https:servername.com/geolocations/locations/33.452/-112.234.

Putting geolocations/location/33.452/-112.234 in the Path field works as expected, but I need to eventually be able to load in a CSV with a large number of lat/long combinations so that we can better test the endpoint.

Is there a way to accomplish this without switching to query params right now?

I tried adding lat and long to the Send Parameters with Request area via:

Name: Value:

lat 33.452

long -112.234

But I think this attempted to make them query params which is incompatible with our current endpoint.

Upvotes: 1

Views: 4676

Answers (1)

Ori Marko
Ori Marko

Reputation: 58862

You can use JMeter variables in Path field

https://servername.com/geolocations/locations/${lat}/${long}

Upvotes: 2

Related Questions