Acorel
To Acorel.nl

Consuming the C4CODATA api via CPI

Said Ait Haddou Ali, 02 December 2020

As SAP is decreasing its support for (standard) SOAP services in Sales and Service Cloud, the standard C4CODATA api is used more and more often when dealing with integration issues. The C4COODATA api documentation can be found HERE. The documentation provides an overview of the specific entities available in the underlying odata model and provides example messages for querying, creating or changing objects.

The following points are important to keep in mind regarding the C4CODATA api:

Now consider an example in which we would like to maintain product data in C4C via an iflow in CPI. The relevant odata URI is the following: https://<ServiceURL>/ProductCollection. We assume incoming messages as described in the examples in the C4C odata documentation (see link above). Questions that pop up are: How do we determine in the iflow which http method to use (POST or PATCH)? How do we add the object ID to the request when needed? An approach is described below:

Step 1: Initialize message header

Step 2: Groovy script to populate filter parameter

Step 3: Perform GET request to fetch CSRF token (and Cookie)

The filter constructed in the previous step (stored in the header) is used for the GET request.

Step 4: Determine whether an existing object ID for product exists. If so, store in header.

Step 5: Prepare header and body for Update/Create request.

Groovy script to add the CSRF Cookie to the post or patch call

Step 6: Restore initial body

Step 7: The call to C4C is performed

Additional tip: In case multiple sub entities need to be changed in one go (for example an Account header, Contacts and Tax data) try using one incoming message which contains the different smaller submessages corresponding to each sub entity. With the splitter functionality the message can be deconstructed. The individual submessage can be processed via the steps mentioned above. Consider creating a local integration process for the steps mentioned above.

Hope this was helpful.

Said Ait Haddou Ali

Read all my blogs

Receive our weekly blog by email?
Subscribe here: