Remote Includes
Please use Remote Includes wisely, especially in combination with caching. Too many cache misses from Remote Includes will negatively affect the system performance. Also, be aware that authentication and authorization are only performed for the main request, but not for the include requests.
With B2C Commerce 25.1, you can further extend API responses by including responses from other sources using Remote Includes.
You can include a response from a SCAPI Custom API or System API, for example to provide additional product details.
Example 1: The hook dw.ocapi.shop.product.modifyGETResponse
is used to customize the product response. A Custom API endpoint, remoteInclude
, delivers a sample which is added to the product with the custom property c_remote
.
Example 2: The hook dw.ocapi.shop.product.modifyGETResponse
is used to customize the product response. It is enhanced with promotion data which is added to the product with the custom property c_remote
.
You can add multiple remote includes in the array and create complex and powerful responses.
- The
RestResponseMgr
methodcreateScapiRemoteInclude()
allows only SCAPI URLs. - The
RestResponseMgr
methodcreateStorefrontControllerRemoteInclude()
allows only Controller URLs.
Cross-API requests (for example, including a Controller response within a Custom API or SCAPI hook) are not possible.
For additional information and examples, see RemoteInclude and Passing Data Between Hooks.