Extending mashups
Mashups are used to invoke XAPIs on the server and return data to the UI layer. You can create new mashups or extend mashups to suit your business needs.
For more information about the mashup layer, see Working with mashups.
Creating mashups
- Save custom mashups in the
<runtime>/extensions/isf/webpages/mashupxmls/folder. Ensure that you suffix the file name with_mashups.xml. - The naming convention for the mashup ID must be
extn_isf.<module_name>.<component_name>.<task>. - If you want to verify the mashup changes for testing, complete any one of the following steps
based on your environment.In on premises environments, complete the following steps:
- Build and update the EAR file in the application server.
- Run
app server restartfor the changes to take effect.
In DTK environments, complete the following steps:- Update the extension jar with the mashup changes.
- Run
./om-compose.sh update-extn <full path to extensions.jar>.
Overriding mashups
To manually extend an application-provided mashup by using the override extensibility, copy the
existing mashups into files with names suffixed _overridemashups.xml in the
<runtime>/extensions/isf/webpages/mashupxmls/ directory.
- In on premises environments, complete the following steps:
- Build and update the EAR file in the application server.
- Run
app server restartfor the changes to take effect.
- In DTK environments, complete the following steps:
- Update the extension jar with the mashup changes.
- Run
./om-compose.sh update-extn <full path to extensions.jar>.
Incrementing mashups
To extend mashups incrementally, when you need attributes to be added to the mashup input or
output, copy the existing mashup into files with names suffixed
_incrementalmashups.xml in the
<runtime>/extensions/isf/webpages/mashupxmls/ directory.
- In on premises environments, complete the following steps:
- Build and update the EAR file in the application server.
- Run
app server restartfor the changes to take effect.
- In DTK environments, complete the following steps:
- Update the extension jar with the mashup changes.
- Run
./om-compose.sh update-extn <full path to extensions.jar>.
Calling REST APIs from the mashup layer
Generally, mashups are used to invoke XAPIs on the server and return data to the UI layer. You can extend mashups to suit your business needs.
Mashups can also be used to make REST calls to any REST end point. This capability is used when after the REST call, an Sterling Order Management System API call needs to be made in the same network call.
For example, the flow to pick products by using the Sterling Store Engagement UI needs to display
product details such as SKU ID, description, and product image along with the Pick Request details.
For this scenario, Get Pick request call on Store Inventory
Management microservice is made and the
REST API output can be massaged to append Item Information by calling getItemList
API in the custom mashup class.
<mashup description="Create a pick request in SIM" endpoint="SIM"
id="isf.backroompick.pick-order.createPickRequest" mashuptype="REST" transactional="true" skipDataProvider="true">
<classInformation name="com.ibm.isf.common.mashups.ISFRestBaseMashup" />
<API Name="pick-requests">
<Input>
<RESTData HTTPMethod="POST" RestURL="" RestEndPointConfigProperty="">
<Input referenceId="" assignedToUserId="" stagingLocationId="" draft="">
<requestedProducts productId="" unitOfMeasure="" productClass="" requestedQuantity=""/>
</Input>
</RESTData>
</Input>
<Template>
<PickRequest/>
</Template>
</API>
<APINamespace inputNS="createPickRequest_input" outputNS="createPickRequest_output" />
<AlternateResourceIds>
<AlternateResourceId altResourceId="ISFSYS00001"/>
<AlternateResourceId altResourceId="ISF000001"/>
<AlternateResourceId altResourceId="ISF000002"/>
</AlternateResourceIds>
</mashup>mashuptype: Specifies whether the mashup makes XAPI or REST API call. Valid values areXAPIandREST.classInformation: REST mashups must usecom.ibm.isf.common.mashups.ISFRestBaseMashupasBaseMashupwhile XAPI callsuses com.ibm.isf.common.mashups.ISFBaseMashupRestEndPointConfigProperty: Specifies theyfsproperty that can be used to retrieve the REST end point.For Store Inventory Management microservice, the
yfsproperty to use isyfs.sim.endpointurl.For example,
RestEndPointConfigProperty="yfs.sim.endpointurl"RestURL: Specifies the URL that needs to be invoked for a particular API.For example, GET call to fetch pick request details by using
pickRequestIdcontains theRestURLasstores/<NodeId>/pick-requests/<pickRequestId>. Here, the mashup output containsPickRequestas the root element name.HTTPMethod: Specifies the HTTP method that is used for making the REST call.Input Element: Used as request Body for making HTTP POST/PATCH/PUT calls. This element is not required for GET/DELETE calls.Template: The child element name of theTemplateelement is the root element of mashup output.Note: Store Inventory Management microservice REST API outputs are not template controlled. Hence, REST mashups are also not template controlled.You must pass all the mandatory input attributes such as
mashuptype,RestEndPointConfigProperty,RestURL, andHTTPMethodfrom the UI. Unlike XAPI mashups, defining the value of an attribute in the mashup XML does not merge it before making the API calls. Also, session objects such asCurrentUserandCurrentStoreare not read for REST mashups.
Extending REST mashups
You can extend Rest mashups by using Override Extensibility.
For more information about building and deploying your customizations, see Building and deploying your customizations.
Packaging custom mashup classes
- Create a JAR file for your custom mashup classes.
- Copy the JAR file to any one of the following directories:
- files/repository/eardata/isf/extn/WEB-INF/lib directory in your source control project. For more information about the source control directory structure, see Importing custom extensions into a developer toolkit environment.
- repository/eardata/isf/extn/WEB-INF/lib directory in the developer toolkit runtime. For more information about packaging custom java classes, see Best practices for developing and packaging custom implementation classes.
- In the extensions JAR file, ensure that the JAR file that contains the custom class must be present in the extensions/files/repository/eardata/isf/extn/WEB-INF/lib directory.