From 1709 version, the Hybris Marketing has introduced new OData V2.0 aka API for:
- Product Hierarchy, Category with write capability - API_MKT_PRODCAT_HIERARCHY_SRV
- Products with write capability - API_MKT_PRODUCT_SRV
- Contact mostly with read capability except Marketingpermission write -API_MKT_CONTACT_SRV - Only for Cloud version as of now
- Interaction Contact mostly with read capability except Marketingpermission write - API_MKT_INTERACTION_CONTACT - Only for Cloud version as of now
Links:
Hybris Marketing Cloud:
Cloud: https://help.sap.com/viewer/0f9408e4921e4ba3bb4a7a1f75f837a7/1708%20500/en-US/06526bdbae42455...
Hybris Marketing Onpremise:
https://help.sap.com/viewer/e68e4c8c856d429b85c2a7370c3553ae/1708%20YMKT/en-US/4700be6de2c04a31bb5aa...
These API can be used to create (POST) Object like Product Hierarchies, Product Categories, Products and sometime Update (PATCH). These are independent Business Object and can be used from now onwards instead of CUAN_IMPORT_SRV.
Advantages:
The main advantages which I found are:
- these service can be called in batch mode to post a lot of records, which is BIG no with CUAN service
- the Update functionality with PATCH operation is available which has big draw back in CUAN_IMPORT service
- the errors in "Import Monitor" are clear to be analysed that which service has error encountered rather than general error from CUAN service
Disadvantages:
The main pain point of these API is comlex syntax and almost no availability of example code in internet and documentation from SAP could have been written in more structured way.
I have succesfully tested the new Product ODatas and would like to share with you all the basic syntax, so that many efforts can be saved.
Example Product Hierarchies:
POST /sap/opu/odata/sap/API_MKT_PRODCAT_HIERARCHY_SRV/$batch HTTP/1.1
Host: <host>.ondemand.com
Authorization: Basic <autehntication>==
x-csrf-token: <token>==
Content-Type: multipart/mixed; boundary=batch
Cache-Control: no-cache
Postman-Token: <token>
--batch
Content-Type: multipart/mixed; boundary=changeset_<can be any number character combination>
--changeset_<can be any number character combination>
content-type: application/http
content-transfer-encoding: binary
PUT ProductHierarchies(ProductHierarchyID='TEST') HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-SequenceId: 001
Sap-Cuan-Timestamp: '2016-01-01T11:16:14'
Sap-Cuan-SequenceNumber: 1
Sap-Cuan-ForceSynchronousProcessing: X
Sap-Cuan-SourceSystemType: <source system type>
Sap-Cuan-SourceSystemId: <source system id>
Content-Type: application/json
{
"ProductHierarchyID":"TEST"
}
--changeset_<same change set number>
content-type: application/http
content-transfer-encoding: binary
PUT ProductHierarchyNames(ProductHierarchyID='TEST',Language='EN') HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-SequenceId: 002
Sap-Cuan-Timestamp: '2016-01-01T11:16:14'
Sap-Cuan-SequenceNumber: 2
Sap-Cuan-ForceSynchronousProcessing: X
Sap-Cuan-SourceSystemType: <source system type>
Sap-Cuan-SourceSystemId: <source system id>
Content-Type: application/json
{
"ProductHierarchyID":"TEST",
"Language" : "EN",
"Name" : "Hierarchy TEST ",
"Description" : "Hierarchy TEST "
}
--changeset_<same change set number>--
--batch--
Important Notes
- batch and changeset syntax are required to package the records
- you can put as much record (as allowed, see best practices) in one single call and end the call with "--batch--"
- all API use HTTP Post mehtod
- the PUT method is used to pass the Key values
- if it is to be PATCH method, it is not HTTP-Methode rather OData Method. Use the PATCH method instead of PUT method in code
Happy Using new API.
🙂