Warm tip: This article is reproduced from serverfault.com, please click

Unable to set mandatory headers for ContactOriginData PATCH in batch mode

发布于 2021-03-05 21:33:27

According to the integration guide for Contacts OData the Sap-Cuan-SequenceId header is mandatory when updating a ContactOriginData record. When updating in singleton mode I am able to set this header as follows and it works without issue:

service
  .updateContactOriginData(contact)
  .withHeader("Sap-Cuan-SequenceId", "PatchUpdate")
  .executeRequest(destination);

However, there is no option to set this header when performing the same update in batch mode:

service
  .batch()
  .beginChangeSet()
  .updateContactOriginData(contact)
  .withHeader(...) // this option does not exist
  .endChangeSet()
  .executeRequest(destination);

When I run the batch one my SAP Import Monitor shows the error:

Invalid content in field Sap-Cuan-SequenceId

Is it possible to set this header in batch mode and I'm just not seeing how? I am using version 3.39.0 of the SDK. Any help would be greatly appreciated!

Thanks!

Questioner
kurts
Viewed
0
Artyom Kovalyov 2021-03-06 08:59:43

This clearly looks like an implementation shortcoming. The SDK has a new API for OData BATCH in the OData v4 client which shouldn't have this issue. Mentioned service exposes OData v2 only and the OData v2 BATCH implementation has been historically different. For compatibility reasons, it has to be kept like this. We plan to provide a parallel implementation to align it with OData v4 and fix many minor and major inconsistencies.

If this is super urgent we can try to provide a workaround using the SDK's generic OData client otherwise create an issue in this GitHub repository and the SDK team will update you when the fix for adding headers is going to be released.