cancel
Showing results for 
Search instead for 
Did you mean: 

How to Resolve "Fewer Than 2 IDs Provided" Error For MarketingPermissions oData Requests

former_member603543
Discoverer
0 Kudos

Hello experts,

I am trying to resolve a Marketing Permissions issue involving an oData call to the API_MKT_CONTACT_SRV service for setting Contact Permission values. Before contacting you I've read through the SAP Integration Guide for Contacts and Johnannes Hirling's "How to Import Contact Data via OData Services..." post, which provides an example of this in the Entity Path – MarketingPermissions section.

So we have code in an iflow that produces the following batch request that's equivalent to Johannes's example, just in XML instead of JSON format. To elaborate, our batchParts request is used for updating the ContactPermission value from 'N' to 'Y' and is structured like this:

<?xml version="1.0" encoding="UTF-8"?>
<batchParts>
  <batchChangeSet>
    <batchChangeSetPart>
       <method>PUT</method>
	  <MarketingPermissions>
	     <MarketingPermission>
		<ContactID>booyakasha@mailinator.com</ContactID>
		<ContactOrigin>BOSCHTOOLS_WEBSITE</ContactOrigin>
		<ContactPermissionID>booyakasha@mailinator.com</ContactPermissionID>
		<ContactPermissionOrigin>BOSCHTOOLS_WEBSITE</ContactPermissionOrigin>
		<MarketingArea>PT-BI-NA</MarketingArea>
		<CommunicationMedium>EMAIL</CommunicationMedium>
		<CommunicationCategory/>
		<ContactPermission>Y</ContactPermission>
		<PermissionUTCDateTime>2019-01-01T09:00:00</PermissionUTCDateTime>
		<PermissionSourceCommMedium>WEB</PermissionSourceCommMedium>
		<PermissionIsExplicit>true</PermissionIsExplicit>
	    </MarketingPermission>
	</MarketingPermissions>
      </batchChangeSetPart>
   </batchChangeSet>
</batchParts>

The oData configuration within the iflow looks like this:

Address:  https://<myservername>-api.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRVOperation Details:  Update(PUT)Resource Path: MarketingPermissions('ContactID','ContactPermissionID','ContactPermissionOrigin','MarketingArea','CommunicationMedium','CommunicationCategory')Fields: PermissionSourceCommMedium,PermissionIsExplicit,PermissionUTCDateTime,ContactID,ContactPermissionID,ContactPermissionOrigin,MarketingArea,CommunicationMedium,CommunicationCategory

It's also worth noting that the corresponding Contact record has already been created via a prior step in the iflow, so we're using the http PUT method here to simply update the ContactPermission value of the MarketingPermission segment for the given Contact.

Anyway after the iflow code is executed, I'm not seeing that the ContactPermission value is changed. After some looking I noticed the error "Fewer Than 2 IDs Provided" is appearing in Import Monitor app for all of my test requests. Here's an example of the failed data record as it appears in the Import Monitor notification pane:

CONTACT_ID: booyakasha@mailinator.com
CONTACT_ORIGIN: BOSCHTOOLS_WEBSITE
MKT_AREA_ID: PT-BI-NA
CONTACT_FACET_ID: booyakasha@mailinator.com
CONTACT_FACET_ID_ORIGIN: BOSCHTOOLS_WEBSITE
OUTBOUND_COMM_MEDIUM: WEB
OPT_IN: Y
COMM_MEDIUM: EMAIL
IA_TIMESTAMP: 20190101091500.0
EXPLICIT: X
mp-get-responsexml.txtIC_TYPE: 00

Not sure what additional IDs are needed to perform the Marketing Permissions update outside of the ones listed in the SAP Integration Guide for Contacts, which are also listed in the Resource Path above. I am able to see the underlying ContactOriginData record(s) already created in the Contacts step by running the following GET request in POSTMAN:

https://myservername-api.s4hana.ondemand.com/sap/opu/odata/SAP/API_MKT_CONTACT_SRV;v=0002/ContactOriginData(ContactID='booyakasha@mailinator.com',ContactOrigin='BOSCHTOOLS_WEBSITE')/MarketingPermissions?$filter=ContactPermissionID eq 'booyakasha@mailinator.com' and CommunicationMedium eq 'EMAIL'&$orderby=PermissionUTCDateTime desc

(Curiously, two Marketing Permission records were created via a single Contacts PUT request, which differ by ContactPermissionOrigin value. I'll attach the actual response message to this question.)

Please let me know what other information I can provide in order for you to offer some insight, suggestions, or additional reading to solve this problem.

Thank you!

John Kormanec

Accepted Solutions (1)

Accepted Solutions (1)

Hi John

You are importing the following IDs:

ContactOrigin: BOSCHTOOLS_WEBSITE
ContactID: booyakasha@mailinator.com
ContactPermissionOrigin: BOSCHTOOLS_WEBSITE
ContactPermissionID: booyakasha@mailinator.com

I would suggest to use EMAIL as ContactPermissionOrigin:

ContactOrigin: BOSCHTOOLS_WEBSITE
ContactID: booyakasha@mailinator.com
ContactPermissionOrigin: EMAIL
ContactPermissionID: booyakasha@mailinator.com

This should to the job for you.

Here you will find a valid JSON payload with all relevant parameters.
You can easily compare this code to your XML payload.

PUT MarketingPermissions(
	ContactID='000111000111000111000',ContactOrigin='Z_MKT_ID',
	ContactPermissionID='20181017test.2@testmail.at',ContactPermissionOrigin='EMAIL',
	MarketingArea='AT',CommunicationMedium='EMAIL',CommunicationCategory=''
	) HTTP/1.1
Accept: application/json
Sap-Cuan-RequestTimestamp: '2018-03-31T14:14:19'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: HYBRIS
Content-Type: application/json
Content-Length: 1021
        {
          "ContactID" : "000111000111000111000",
          "ContactOrigin" : "Z_MKT_ID",
          "ContactPermissionID" : "20181017test.2@testmail.at",
          "ContactPermissionOrigin" : "EMAIL",
          "PermissionUTCDateTime" : "2018-03-31T14:08:29",
          "ContactPermission" : "Y",
          "CommunicationMedium" : "EMAIL",
          "PermissionSourceCommMedium" : "EMAIL"
        }
former_member603543
Discoverer
0 Kudos

Thank you, Christian. Your solution appears to work, although I'm not sure I understand why.

Answers (0)