Combining data from JSON respnose with data in parameterlist used by a request body

I have:

`

.feed(csv(“memberInfo.csv”).random)

.exec(
http(“activateCoupon”)
.post("/coupon/activate")
.header(“X-Token”, “mock”)
.body(ELFileBody(“activateCoupons.json”)).asJSON
.check(status.is(200))
.check(jsonPath("$.resultCode").is(“SUCCESS”)))

`

where activateCoupons.json looks like this:

`
{“offerId”: “${offerId}”, “membershipId”: “${memberID}”, “osName”: “iOS”, “osVersion”: “8.02”}

`

and where memeberInfo.csv looks like this:

memberID,offerId 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3

I want to modify this (it is working great)

The .exec before the one I have provided gets a response body looking (partly) like this:

`

{"resultCode":"SUCCESS","errorCode":null,"errorMessage":null,"coupons":[{"id":"eb6908a2-8bcd-4c7e-8d60-b3c35822bba3",

`

I want to get the ‘id’ and I use:

.check(jsonPath("$.coupons[0].id").saveAs("couponId")))

This also Works as expected, but can I a request body combining the “on-the-fly” ‘id’ with parameters in a .csv file and still use ELFileBody?

Or should I use StringBody like this:

`
//.body(StringBody("""{“offerId”: “${couponId}”, “membershipId”: “${memberID}”, “osName”: “iOS”, “osVersion”: “8.02”}""")).asJSON

`

I would prefer to use ElFileBody, but I do not know how to combine testdata from the response “on-the-fly” with “static testdata”.

Magnus

``

Ok, to be spesific, can I combine testdata from the response and saved as a local variable, with testdata from a datasource, a .csv file like this:

{"offerId": "${offerId}", "membershipId": "${memberID}", "osName": "iOS", "osVersion": "8.02"}

Where 'offerId' is regex'ed from a json response and 'memberId' is from a .csv file?

Is this possible to combine there two using ELFileBody and a request body?

Yes, of course