Remote Includes
With B2C Commerce 24.2, you can build your own SCAPI responses and include responses from other sources, such as SCAPI System APIs or other Custom APIs, using Custom API Remote Includes.
As discussed in Custom API Authentication, Custom API endpoints are secured using either Shopper Login and API Access or Account Manager based Authentication and Authorization, just like other SCAPI endpoints.
You can include a response from another Custom API or an out-of-the-box SCAPI API, for example: Shopper Products getProducts, and annotate it with additional information.
For example: let’s use an API endpoint named includeTest1
. A second API endpoint, remoteInclude
, grabs the response from the includeTest1
endpoint and adds it to the includeArray
array as includeArrayItem1
.
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. - Defining a large number of Remote Includes can degrade system performance. Currently, using more than 50 includes per request triggers a warning. In the future, this limit will be strictly enforced, causing errors. Stay within the threshold to avoid issues.
For additional information , see Passing Data Between Hooks.