Search code examples
apirestjmeterresponseextract

How to retrieve Jmeter response and use on Http request


Example the request I used is "https://test.com/devices/entities/devices/v1?ids=abc"

and this is my response:

{ "meta": { "query_time": 0.003134801, "powered_by": "device-api", "trace_id": "Test" }, "resources": [{ "device_id": "ABCD-1234", "hostname": "Test-Machine1" }] }

My question here is how can I extract the value of device_id, hostname so I could use that on my Http request every invoke. Hoping for your response. Thank you so much.

Expected Result: I want to retrieve the device_id, hostname and used that on my Http request every invocation

enter image description here


Solution

  • You can do it using JSON Extractor, the relevant JSON Path Expressions would be $..hostname and $..device_id correspondingly

    Demo:

    enter image description here