Gatling loadtest script help

Say I need to write a gatling loadtest script that needs to call two APIs A1 and A2. It first needs to call A1 which will return a JSON payload, it needs to extract a field in the JSON payload and use that field value in calling the second API. Can anyone let me know how can I do that? This script is for loadtesting our servers restful APIs that are over HTTP.

Just capture some values in the A1 response with regex or JsonPath checks + saveAs, then reinject them in the A2 body

https://github.com/excilys/gatling/wiki/Checks#wiki-regex

https://github.com/excilys/gatling/wiki/Checks#wiki-json

https://github.com/excilys/gatling/wiki/HTTP#wiki-request-body

Cheers,

St├ęphane

Excellent, thanks a lot.