Working with REST services
We can work with existing REST services to meet your business needs. The REST services framework is intended to be customizable to suit your business needs. We can customize REST services in the following ways:
- Data Mapping
- The data mapping file explicitly maps a data field in REST representation to a data field in the BOD. Specific data fields of the BOD can be added or removed from the representation through customizable configuration files.
- Code Generation
- Code generation enables creating the initial code for a resource handler that is based on a BOD noun that is being modeled with representations mirroring the BOD attributes.
- User Data
- User data can be created and retrieved by using REST services. Since REST services are built on top of OAGIS services, it requires all the necessary steps to extend business logic and persist User Data.
- Representation templates
- We can create a representation template (JSP file) per resource in the file system used to generate the representation for specific media types, such as XHTML and Atom feeds.
- REST services in storefront JSP files
The responsive Aurora starter store and site widget JSP files consume REST resources using the wcf:rest tag.- Mapping REST resources to Business Object Document (BOD) nouns
REST services are built on top of OAGIS services. Each REST resource is mapped to a Business Object Document (BOD) noun. An XML configuration file is provided to transform between a BOD noun and REST data. The REST services framework then uses this configuration file to generate REST response data from a BOD object and construct a BOD object from REST request data.- REST response formats
REST services support JSON and XML formats for input and output data by default. The default format is JSON.- Customizing the catalog entry details page to retrieve specific merchandising associations
We can customize the catalog entry details page for a catalog entry type to use merchandising association enhancements to the productViewHandler REST service and the categoryNavigationView noun. By customizing the catalog entry details pages to use the enhanced REST service, we can define the specific merchandising association types that return for each type of catalog entry. By default all merchandising associations associated with a catalog entry are displayed when a shopper views the catalog entry details for a catalog entry.- Customizing REST services to support new custom response formats
We can extend the default JAX-RS resource handlers to customize REST services to support new custom response formats.- Configure Cross-Origin Resource Sharing (CORS) headers
WebSphere Commerce supports Cross-Origin Resource Sharing (CORS). The HttpSecurityFilter servlet filter supports the configuration of CORS-related headers included in the HTTP response. We can configure the filter by extending the component configuration file (wc-component.xml).- Logging REST responses
We can log REST responses after requests are made.