on 12-03-2021 4:19 PM
Hey there. I am currently trying to set up some batch request to 1) create/update a contact 2) set the marketing area for the contact 3) set the permission for the contact.
However, I get the error "Batch request payload is invalid".
I am setting up the request in Postman for OData service API_MKT_CONTACT_SRV;v=0003.
X-csrf-token and content-type are defined in the headers:
The body in Postman is set to raw (text):
--batch_01869434-0010
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
Content-Type: application/http
Content-Transfer-Encoding: binary
PUT ContactOriginData(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER') HTTP/1.1<br>Content-Type: application/json
Accept: application/json
{
"OriginDataLastChgUTCDateTime": "2021-12-03T16:58:56.040721",
"EmailAddress": "chris@patch.de",
"IsContact": true,
"FullName": "Chris Patch",
"FirstName": "Chris",
"LastName": "Patch",
"CityName": "München",
"EmailAddress": "chris@patch.de"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH MarketingAreas(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',InteractionContactMktgArea='DE') HTTP/1.1
Content-Type: application/json
Accept: application/json
{
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
Content-Type: application/http
Content-Transfer-Encoding: binary
PUT MarketingPermissions(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',ContactPermissionID='chris@patch.de',ContactPermissionOrigin='EMAIL',MarketingArea='DE',CommunicationMedium='EMAIL') HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"CommunicationMedium": "EMAIL",
"ContactID": "chris@patch.de",
"ContactOrigin": "SAP_HYBRIS_CONSUMER",
"ContactPermissionID": "chris@patch.de",
"ContactPermissionOrigin": "EMAIL",
"MarketingArea": "DE",
"PermissionUTCDateTime": "2021-12-03T16:58:56.040721",
"PermissionGranted": "Y",
"PermissionNoteText": "Permission via Webshop"
}
--batch_01869434-0010--
Does anyone see the issue?
Thank you!
Hi Christian,
at least you need the Sap-Cuan-RequestTimestamp in the Request Header as described here: https://help.sap.com/viewer/0f9408e4921e4ba3bb4a7a1f75f837a7/2111.500/en-US/95f2c87395bb4dda90501042...
For the PATCH additionally the Sap-Cuan-SequenceId is mandatory
In addition to that you forgot the --changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309-- at the end before the --batch_01869434-0010--
I adapted the payload based on the help page mentioned above, like that it should work:
--batch_01869434-0010
Content-Type: multipart/mixed; boundary=changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT ContactOriginData(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER') HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-RequestTimestamp: '2018-01-01T12:14:14'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: HYBRIS
Content-Type: application/json
{
"OriginDataLastChgUTCDateTime": "2021-12-03T16:58:56.040721",
"EmailAddress": "chris@patch.de",
"IsContact": true,
"FullName": "Chris Patch",
"FirstName": "Chris",
"LastName": "Patch",
"CityName": "München",
"EmailAddress": "chris@patch.de"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT MarketingPermissions(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',ContactPermissionID='chris@patch.de',ContactPermissionOrigin='EMAIL',MarketingArea='DE',CommunicationMedium='EMAIL') HTTP/1.1
Accept: application/json
Content-Length: 1035
Sap-Cuan-RequestTimestamp: '2018-01-01T12:14:14'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: HYBRIS
Sap-Cuan-SequenceId: UpdatePatch
Content-Type: application/json
{
"CommunicationMedium": "EMAIL",
"ContactID": "chris@patch.de",
"ContactOrigin": "SAP_HYBRIS_CONSUMER",
"ContactPermissionID": "chris@patch.de",
"ContactPermissionOrigin": "EMAIL",
"MarketingArea": "DE",
"PermissionUTCDateTime": "2021-12-03T16:58:56.040721",
"PermissionGranted": "Y",
"PermissionNoteText": "Permission via Webshop"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309--
--batch_01869434-0010--
BR Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry chackbusch, in my previous payload I forgot the PATCH part. This one is the correct one:
--batch_01869434-0010
Content-Type: multipart/mixed; boundary=changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT ContactOriginData(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER') HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-RequestTimestamp: '2018-01-01T12:14:14'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: HYBRIS
Content-Type: application/json
{
"OriginDataLastChgUTCDateTime": "2021-12-03T16:58:56.040721",
"EmailAddress": "chris@patch.de",
"IsContact": true,
"FullName": "Chris Patch",
"FirstName": "Chris",
"LastName": "Patch",
"CityName": "München",
"EmailAddress": "chris@patch.de"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH MarketingAreas(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',InteractionContactMktgArea='DE') HTTP/1.1
Content-Length: 1035
Accept: application/json
Sap-Cuan-RequestTimestamp: '2018-01-01T12:14:14'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: HYBRIS
Sap-Cuan-SequenceId: UpdatePatch
Content-Type: application/json
{
"ContactID": "chris@patch.de"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT MarketingPermissions(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',ContactPermissionID='chris@patch.de',ContactPermissionOrigin='EMAIL',MarketingArea='DE',CommunicationMedium='EMAIL') HTTP/1.1
Accept: application/json
Content-Length: 1035
Sap-Cuan-RequestTimestamp: '2018-01-01T12:14:14'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: HYBRIS
Content-Type: application/json
{
"CommunicationMedium": "EMAIL",
"ContactID": "chris@patch.de",
"ContactOrigin": "SAP_HYBRIS_CONSUMER",
"ContactPermissionID": "chris@patch.de",
"ContactPermissionOrigin": "EMAIL",
"MarketingArea": "DE",
"PermissionUTCDateTime": "2021-12-03T16:58:56.040721",
"PermissionGranted": "Y",
"PermissionNoteText": "Permission via Webshop"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309--
--batch_01869434-0010--<br>
Hey
You pointed me to the right direction with the headers and changeset I forgot! However, I still had issues but could solve them (IsContactPerson instead of IsContact, EmailAddress was duplicate). Furthermore, I think PUT is better in our case. So I changed everything to PUT. I also removed the content-length parameter since for me it worked also without.
Thanks for your hints and have a nice weekend.
My adapted code works (contact creation/update, marketing area creation/update, permission creation):
--batch_01869434-0010
Content-Type: multipart/mixed; boundary=changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT ContactOriginData(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER') HTTP/1.1
Sap-Cuan-RequestTimestamp: '2021-12-03T12:59:56'
Content-Type: application/json
{
"OriginDataLastChgUTCDateTime": "2021-12-03T12:58:56",
"FullName": "Chris Patch",
"FirstName": "Chris",
"LastName": "Patch",
"CityName": "Offenburg",
"EmailAddress": "chris@patch.de"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT MarketingAreas(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',InteractionContactMktgArea='DE') HTTP/1.1
Sap-Cuan-RequestTimestamp: '2021-12-03T12:59:56'
Content-Type: application/json
{
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309
content-type: application/http
content-transfer-encoding: binary
PUT MarketingPermissions(ContactID='chris@patch.de',ContactOrigin='SAP_HYBRIS_CONSUMER',ContactPermissionID='chris@patch.de',ContactPermissionOrigin='EMAIL',MarketingArea='DE',CommunicationMedium='EMAIL') HTTP/1.1
Sap-Cuan-RequestTimestamp: '2021-12-03T12:59:56'
Content-Type: application/json
{
"CommunicationMedium": "EMAIL",
"ContactID": "chris@patch.de",
"ContactOrigin": "SAP_HYBRIS_CONSUMER",
"ContactPermissionID": "chris@patch.de",
"ContactPermissionOrigin": "EMAIL",
"MarketingArea": "DE",
"PermissionUTCDateTime": "2021-12-03T12:59:56",
"PermissionGranted": "Y",
"PermissionNoteText": "Permission via Webshop"
}
--changeset_695af0de-aa06-4fa7-a2d7-0abfebcde309--
--batch_01869434-0010--
Hi all,
Is it possible to mass change Mkt permission in the SAP Marketing Cloud System?
BR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.