cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to set fixed value for URI and flexible for batch request

maik_bosch
Contributor
0 Kudos

Dear Experts,

we are trying to load Marketing Attributes to SAP Marketing Cloud via SAP Cloud Integration.

But the question is more a general one for URI management of Odata adapter.

Basically when I push via postman the following it is working fine

--batch
Content-Type: multipart/mixed; boundary=changeset_9b71d0d9-cdca-4b56-b00b-8751e1449ac9


--changeset_9b71d0d9-cdca-4b56-b00b-8751e1449ac9
Content-Type: application/http
Content-Transfer-Encoding: binary


PATCH MarketingAttributes(ContactOrigin='Z_MKT_ATTRIBUTE',ContactID='123456789new',MarketingAttributeCategory='COUPONING',MarketingAttributeValue='campaign_name_Campaign1') HTTP/1.1
Content-Length: 637
Sap-Cuan-SourceSystemId: COUPONING_SEB
Sap-Cuan-SequenceId: UpdatePatch
Sap-Cuan-RequestTimestamp: 2021-03-09T15:27:47
Content-Type: application/atom+xml


<?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://myXXXXXX-api.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=0002"><content type="application/xml"><m:properties><d:MarketingAttributeCategory>COUPONING</d:MarketingAttributeCategory><d:MarketingAttributeValue>campaign_name_Campaign 1</d:MarketingAttributeValue><d:ContactID>123456789new</d:ContactID><d:ContactOrigin>Z_MKT_ATTRIBUTE</d:ContactOrigin></m:properties></content></entry>


--changeset_9b71d0d9-cdca-4b56-b00b-8751e1449ac9--
--batch--

But when I try to use the Odata adpater in Cloud Integration it is automatically taking the content of <d:MarketingAttributeValue>campaign_name_Campaign 1</d:MarketingAttributeValue> and is putting this to the URI part of the payload.

So the resulting URI is the one below which is then failing with error code 400 bad request.

Which is clear as there is now a space (" ") in the URI.

So my question is how to avoid in special cases that the odata adapter takes the value and puts it into the URI? As the system is anyway taking into consideration the value mentioned in the body?

Is there a way to fix (e.g. always take "value1") the value in the URI? And at the same time stay with flexible value in the body?

PATCH MarketingAttributes(ContactOrigin='Z_MKT_ATTRIBUTE',ContactID='123456789new',MarketingAttributeCategory='COUPONING',MarketingAttributeValue='campaign_name_Campaign 1') HTTP/1.1

Accepted Solutions (1)

Accepted Solutions (1)

maik_bosch
Contributor

Solved it on my own. It is working via HTTP adapter and splitter combination (in case more than one is coming in).

In HTTP adapter payload I can define like below

For XSRF token handling see: https://blogs.sap.com/2017/07/06/handling-csrf-tokens-in-sap-cloud-platform-integration/

--batch
Content-Type: multipart/mixed; boundary=changeset_761e49b6-3146-4a57-8d10-15816fb9c75a


--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a
content-type: application/http
content-transfer-encoding: binary


PATCH MarketingAttributes(ContactID='${property.ContactID}',ContactOrigin='${property.ContactOrigin}',MarketingAttributeCategory='${property.MarketingAttributeCategory}',MarketingAttributeValue='dummy') HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-RequestTimestamp: '${property.Sap-Cuan-RequestTimestamp}'
Sap-Cuan-SourceSystemType: CPI
Sap-Cuan-SourceSystemId: CPI
Sap-Cuan-SequenceId: UpdatePatch 
Content-Type: application/json


{
"ContactID": "${property.ContactID}",
"MarketingAttributeValue": "${property.MarketingAttributeValue}"
}


--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a--
--batch--

Answers (0)