Service Mashup is an aggregator of Service Callouts configured as asynchronous. By allowing external callouts to execute in parallel, Service Mashup provides an advantage over execution time of the call to the centralizing API by making better use of time, as demonstrated below.
NOTEThe Service Mashup stops the flow until the Service Callouts calls linked to it are completed.
The image below shows the settings for the interceptor:

To show how Service Mashup works, let's consider the following case:
NOTEAn organization, the LSA (Lost Souls' Alliance), will develop a central API, LSA Communication, which will be able to send, via POST, the same message (or command) to people inside and outside the organization. This API will be registered under the domain lsa.org.mx.
The message, sent as a JSON in the body of the call, will be:
The case of internal communication has been addressed in how Internal API Call works. The case of the external one, in how Service Callout works. Now let's combine these two communications into a single call.
The following images show, respectively, the sequence of the interceptors in the API flow and the settings used in the Service Mashup interceptor, which waits for the responses of the two Service Callout interceptors to continue the flow:


The settings used for the Internal API Call interceptor are the same as described in how it works. Those used for the two Service Callout interceptors are also the same as those described in how they work, except that the Asynchronous field has been checked and therefore the use of Service Mashup becomes necessary.
Unlike the case where the two Service Callout interceptors were configured to act synchronously, now both are executed in parallel. To take advantage of the waiting time, the Internal API Call is called after them, being executed while the other two calls are in progress.
At the end of the execution of the Internal API Call, the returned response, which is an object of type ApiResponse, is stored in the context variables.
Next, the Service Mashup waits for the responses returned by the two Service Callout interceptors, which are objects of type RESTResponse, and also stores these responses in the context variables.
To retrieve all responses, you must create a custom interceptor that accesses $call.contextVariables.get("Variable Name").
Below is the code for the custom JavaScript interceptor that will be used to capture all the responses and include the bodies and status in the final response:
Finally, the body of the response of the POST call to the all-messages resource of LSA Communication will be:
We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more