Skip to main content
You can store response data from one API call and use it in the request body of another. This is done using $sharedState, allowing seamless data sharing between Modify Response and Modify Request rules
$sharedState is only available in extension versions > v24.8.13 and desktop app versions > v1.7.1.

Aggregate Data from API Response

1

Create a Modify Response Rule

Open Requestly Interceptor and create a new Modify Response rule.
2

Select Dynamic Modification (JavaScript)

Choose Dynamic JavaScript Modification in the rule options
3

Store Response Data in $sharedState

Use the following code to store response values like products and currency:

Use Aggregated Data in Request Body

1

Create a Modify Request Body Rule

Create a new Modify Request Body rule in Requestly Interceptor.
2

Select Dynamic Modification (JavaScript)

Select the Dynamic Modification option.
3

Use Data from $sharedState in the Request

Inject the stored products and currency into your outgoing request
Here’s the code to include the previously saved data: