Integration is a key part of any e-commerce solution. As businesses customize their systems more, the challenge of connecting different applications grows. Customers want to manage things themselves and automate processes, which requires a strong connection between the ERP (Enterprise Resource Planning) system and the e-commerce platform.
Integrations and data management are essential components of SAP Commerce Cloud, enabling businesses to connect their e-commerce platform with various external systems and effectively manage data across the organization. Integrations facilitate communication between SAP Commerce Cloud and other systems (like ERP, CRM, and third-party applications), ensuring seamless data flow.
SAP Commerce provides various solutions for integrating with other SAP applications and services. These integration tools help you quickly set up Context-Driven Services applications and transfer master data between your system and SAP backend systems using Integration APIs that connect to the SAP Business Technology Platform.
For managing master data, SAP Commerce includes essential tools like the Integration API Module and Data Hub. These tools enable you to connect with SAP backend systems for managing customer data, product information, pricing, order fulfillment, and invoicing.
Integration API Module: The Integration API Module in SAP Commerce provides a set of interfaces for data integration. You can use this module to connect services, allowing you to send or receive data from SAP Commerce.
Data Hub: A powerful tool for managing data flows and transformations, connecting SAP Commerce with other data sources. SAP Hybris Data hub will be used for asynchronous bi-directional data integrations with backend systems
Integration Objects: These are specific to different use cases. For example, an Integration Object for SAP ERP might use all available fields, while one for SAP Marketing might focus only on fields relevant to marketing needs.
Enhanced OData Protocol: This is tailored for use with Integration API services.
Backoffice Tools: These tools help you model Integration Objects and monitor Integration API requests.
Integration Objects are key components within the Integration API Module of SAP Commerce Cloud. They define the structure and properties of the data being exchanged between SAP Commerce and external systems.
Integration Objects can be categorized into two main types based on the direction of data flow: Inbound Integration Objects and Outbound Integration Objects.
Inbound Integration Objects are used for importing data into SAP Commerce Cloud from external systems. They allow external applications to send information, which is then processed and stored in SAP Commerce.
Outbound Integration Objects are used for exporting data from SAP Commerce Cloud to external systems. They allow the platform to send information out to other applications or services.
You can create Integration Objects in several ways:
Using ImpEx: You can import an Integration Object model via ImpEx scripts, making it easy to set up multiple objects quickly.
Through the Meta API: You can post an Integration Object model directly using the Meta API, which allows for programmatic creation and management.
Via the Backoffice: The Backoffice interface provides tools for modeling and managing Integration Objects, offering a user-friendly way to define data structures.
You can view existing Integration Objects and their details through the Integration Services endpoint. For example:
GET https://localhost:9002/odata2webservices/IntegrationService/IntegrationObjects
To retrieve metadata about these objects, you can append the $metadata query option:
GET https://localhost:9002/odata2webservices/IntegrationService/IntegrationObjects?$metadata
You can create Integration Objects using ImpEx scripts to define the structure of your data models and facilitate integration with external systems.
By defining these attributes, you specify how data is structured and what fields will be included in data exchanges with external systems.
IntegrationObject: A model that defines the structure of the data to be exchanged.
IntegrationObjectItem: Represents a specific data entity (like Product or Customer) within the IntegrationObject.
IntegrationObjectItemAttribute: Specifies the individual attributes of an IntegrationObjectItem, including their data types and properties.
INSERT_UPDATE IntegrationObject; code[unique = true];
; MyProduct
INSERT_UPDATE IntegrationObjectItem; integrationObject(code)[unique = true]; code[unique = true]; type(code)
; MyProduct ; Product ; Product
; MyProduct ; Catalog ; Catalog
; MyProduct ; CatalogVersion ; CatalogVersion
; MyProduct ; Unit ; Unit
INSERT_UPDATE IntegrationObjectItemAttribute; integrationObjectItem(integrationObject(code), code)[unique = true]; attributeName[unique = true]; attributeDescriptor(enclosingType(code), qualifier); returnIntegrationObjectItem(integrationObject(code), code); unique[default = false]
; MyProduct:Product ; code ; Product:code ;
; MyProduct:Product ; catalogVersion ; Product:catalogVersion ; MyProduct:CatalogVersion
; MyProduct:Product ; name ; Product:name ;
; MyProduct:Product ; unit ; Product:unit ; MyProduct:Unit
; MyProduct:Unit ; code ; Unit:code ;
; MyProduct:Catalog ; id ; Catalog:id ;
; MyProduct:CatalogVersion ; catalog ; CatalogVersion:catalog ; MyProduct:Catalog
; MyProduct:CatalogVersion ; version ; CatalogVersion:version
OData (Open Data Protocol) is a widely adopted protocol designed for building and using RESTful APIs. It facilitates the creation of interoperable and queryable web services, making it easier to interact with data across different systems. The Integration API uses and extends the OData protocol for building and using RESTful APIs
An Integration Object describes the structure of a business-level entity. Integration objects are the foundation for an EDMX schema and for the APIs used for Process Integration and Master Data Synchronization of SAP Commerce.
To retrieve a list of all the IntegrationObjectItems that belong to a particular IntegrationObject, send a GET request to the service root URI of the specified Integration Object. This EndPoint will create automictic by Hybris once you create integration Object
GET : https://localhost:9002/odata2webservices/[integrationObject.code]
Example: https://localhost:9002/odata2webservices/MyProduct
Response
<?xml version='1.0' encoding='utf-8'?>
<service xml:base="https://localhost:9002/odata2webservices/MyProduct/" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
<workspace>
<atom:title>Default</atom:title>
<collection href="Localized___Products">
<atom:title>Localized___Products</atom:title>
</collection>
<collection href="CatalogVersions">
<atom:title>CatalogVersions</atom:title>
</collection>
<collection href="Products">
<atom:title>Products</atom:title>
</collection>
<collection href="Units">
<atom:title>Units</atom:title>
</collection>
<collection href="Catalogs">
<atom:title>Catalogs</atom:title>
</collection>
</workspace>
</service>
The odata2webservices extension allows you to create an EDMX schema for an imported Integration Object.
GET: https://localhost:9002/odata2webservices/[integrationObject.code]/$metadata
Example: https://localhost:9002/odata2webservices/MyProduct/$metadata
The query creates an EDMX schema and passes it to a validation routine
Response :
<?xml version='1.0' encoding='UTF-8'?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
<edmx:DataServices m:DataServiceVersion="1.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="HybrisCommerceOData" xmlns="http://schemas.microsoft.com/ado/2008/09/edm" s:schema-version="1" xmlns:s="http://schemas.sap.com/commerce">
<EntityType Name="Localized___Product">
<Key>
<PropertyRef Name="language"/>
</Key>
<Property Name="name" Type="Edm.String" s:IsLanguageDependent="true" Nullable="true"/>
<Property Name="language" Type="Edm.String" Nullable="false"/>
</EntityType>
<EntityType Name="CatalogVersion">
<Key>
<PropertyRef Name="integrationKey"/>
</Key>
<Property Name="version" Type="Edm.String" Nullable="false" s:IsUnique="true"/>
<Property Name="integrationKey" Type="Edm.String" Nullable="false" s:Alias="CatalogVersion_version|Catalog_id"/>
<NavigationProperty Name="catalog" Relationship="HybrisCommerceOData.FK_CatalogVersion_catalog" FromRole="CatalogVersion" ToRole="Catalog" Nullable="false" s:IsUnique="true"/>
</EntityType>
<EntityType Name="Product">
<Key>
<PropertyRef Name="integrationKey"/>
</Key>
<Property Name="name" Type="Edm.String" s:IsLanguageDependent="true" Nullable="true"/>
<Property Name="code" Type="Edm.String" Nullable="false" s:IsUnique="true"/>
<Property Name="integrationKey" Type="Edm.String" Nullable="false" s:Alias="CatalogVersion_version|Catalog_id|Product_code"/>
<NavigationProperty Name="catalogVersion" Relationship="HybrisCommerceOData.FK_Product_catalogVersion" FromRole="Product" ToRole="CatalogVersion" Nullable="false" s:IsUnique="true"/>
<NavigationProperty Name="unit" Relationship="HybrisCommerceOData.FK_Product_unit" FromRole="Product" ToRole="Unit" Nullable="true"/>
<NavigationProperty Name="localizedAttributes" Relationship="HybrisCommerceOData.FK_Product_localizedAttributes" FromRole="Product" ToRole="Localized___Product" Nullable="true"/>
</EntityType>
<EntityType Name="Unit">
<Key>
<PropertyRef Name="integrationKey"/>
</Key>
<Property Name="code" Type="Edm.String" Nullable="false" s:IsUnique="true"/>
<Property Name="integrationKey" Type="Edm.String" Nullable="false" s:Alias="Unit_code"/>
</EntityType>
<EntityType Name="Catalog">
<Key>
<PropertyRef Name="integrationKey"/>
</Key>
<Property Name="id" Type="Edm.String" Nullable="false" s:IsUnique="true"/>
<Property Name="integrationKey" Type="Edm.String" Nullable="false" s:Alias="Catalog_id"/>
</EntityType>
<Association Name="FK_Product_catalogVersion">
<End Type="HybrisCommerceOData.Product" Multiplicity="0..1" Role="Product"/>
<End Type="HybrisCommerceOData.CatalogVersion" Multiplicity="0..1" Role="CatalogVersion"/>
</Association>
<Association Name="FK_Product_unit">
<End Type="HybrisCommerceOData.Product" Multiplicity="0..1" Role="Product"/>
<End Type="HybrisCommerceOData.Unit" Multiplicity="0..1" Role="Unit"/>
</Association>
<Association Name="FK_CatalogVersion_catalog">
<End Type="HybrisCommerceOData.CatalogVersion" Multiplicity="0..1" Role="CatalogVersion"/>
<End Type="HybrisCommerceOData.Catalog" Multiplicity="0..1" Role="Catalog"/>
</Association>
<Association Name="FK_Product_localizedAttributes">
<End Type="HybrisCommerceOData.Product" Multiplicity="1" Role="Product"/>
<End Type="HybrisCommerceOData.Localized___Product" Multiplicity="*" Role="Localized___Product"/>
</Association>
<EntityContainer Name="Container" m:IsDefaultEntityContainer="true">
<EntitySet Name="Localized___Products" EntityType="HybrisCommerceOData.Localized___Product"/>
<EntitySet Name="CatalogVersions" EntityType="HybrisCommerceOData.CatalogVersion"/>
<EntitySet Name="Products" EntityType="HybrisCommerceOData.Product"/>
<EntitySet Name="Units" EntityType="HybrisCommerceOData.Unit"/>
<EntitySet Name="Catalogs" EntityType="HybrisCommerceOData.Catalog"/>
<AssociationSet Name="Product_CatalogVersions" Association="HybrisCommerceOData.FK_Product_catalogVersion">
<End EntitySet="Products" Role="Product"/>
<End EntitySet="CatalogVersions" Role="CatalogVersion"/>
</AssociationSet>
<AssociationSet Name="Product_Units" Association="HybrisCommerceOData.FK_Product_unit">
<End EntitySet="Products" Role="Product"/>
<End EntitySet="Units" Role="Unit"/>
</AssociationSet>
<AssociationSet Name="CatalogVersion_Catalogs" Association="HybrisCommerceOData.FK_CatalogVersion_catalog">
<End EntitySet="CatalogVersions" Role="CatalogVersion"/>
<End EntitySet="Catalogs" Role="Catalog"/>
</AssociationSet>
<AssociationSet Name="Product_Localized___Products" Association="HybrisCommerceOData.FK_Product_localizedAttributes">
<End EntitySet="Products" Role="Product"/>
<End EntitySet="Localized___Products" Role="Localized___Product"/>
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
After you import the Integration Object into SAP Commerce, the environment is ready for you to POST the data through the exposed endpoint. You can create an item based on a previously defined IntegrationObject definition.
The following POST request to the MyProduct service creates a Product type.
POST: https://localhost:9002/odata2webservices/[integrationObject.code]/[Entity]
Example: https://localhost:9002/odata2webservices/MyProduct/Products
Payload:
{
"@odata.context": "$metadata#Products/$entity",
"code": "1234",
"name": "product description 1",
"catalogVersion": {
"catalog": {
"id": "Default"
},
"version": "Staged"
}
}
Once You Post this request. you will get below response and Data is created in Hybris. You can validate data from Backoffice
<?xml version='1.0' encoding='utf-8'?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://localhost:9002/odata2webservices/MyProduct/">
<id>https://localhost:9002/odata2webservices/MyProduct/Products('Staged%7CDefault%7C1234')</id>
<title type="text">Products</title>
<updated>2024-10-28T15:46:02.875Z</updated>
<category term="HybrisCommerceOData.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<link href="Products('Staged%7CDefault%7C1234')" rel="edit" title="Product"/>
<link href="Products('Staged%7CDefault%7C1234')/catalogVersion" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/catalogVersion" title="catalogVersion" type="application/atom+xml;type=entry"/>
<link href="Products('Staged%7CDefault%7C1234')/unit" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/unit" title="unit" type="application/atom+xml;type=entry"/>
<link href="Products('Staged%7CDefault%7C1234')/localizedAttributes" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/localizedAttributes" title="localizedAttributes" type="application/atom+xml;type=feed"/>
<content type="application/xml">
<m:properties>
<d:name>product description 1</d:name>
<d:code>1234</d:code>
<d:integrationKey>Staged|Default|1234</d:integrationKey>
</m:properties>
</content>
</entry>