Skip to Content

From 1709 version, the Hybris Marketing has introduced new OData V2.0 aka API for:

  1. Product Hierarchy, Category with write capability – API_MKT_PRODCAT_HIERARCHY_SRV
  2. Products with write capability – API_MKT_PRODUCT_SRV
  3. Contact mostly with read capability except Marketingpermission write -API_MKT_CONTACT_SRV – Only for Cloud version as of now
  4. 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/06526bdbae42455ba69a4aef0750561b.html

Hybris Marketing Onpremise:

https://help.sap.com/viewer/e68e4c8c856d429b85c2a7370c3553ae/1708%20YMKT/en-US/4700be6de2c04a31bb5aa8fa084a3927.html

 

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:

  1. these service can be called in batch mode to post a lot of records, which is BIG no with CUAN service
  2. the Update functionality with PATCH operation is available which has big draw back in CUAN_IMPORT service
  3. 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

  1. batch and changeset syntax are required to package the records
  2. you can put as much record (as allowed, see best practices) in one single call and end the call with “–batch–“
  3. all API use HTTP Post mehtod
  4. the PUT method is used to pass the Key values
  5. 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. 🙂

 

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Laura Fuster

    Hi Krishnendu Laha,

    Thank you so much for your post. But I have some doubts about the new API…
    Well, what about new custom fields? how we can see them to import using new API? And finally, I would like to know, if it is normal that Twitter or Facebook don’t appear in Entity type: contact

    https://<Server&gt;:<Port>/sap/opu/odata/SAP/API_MKT_CONTACT_SRV/$metadata

    I don’t knos if this problem is something wrong in my system or if it is in general.

     

    Thank you,

    Best regards,

     

    Laura.

    (0) 
    1. Krishnendu Laha Post author

      Hello Laura,

       

      The custom fields would appear definately under particular node, in your example under entity “Contact” (API_MKT_CONTACT_SRV) all the custom filed which was created for “Interaction and Contact” would appear.

       

      Twitter and Facebook are ID originis, that means we become data from these sources, those are not entities.

       

      Thanks, Krish

      (0) 

Leave a Reply