In my previous article, I talked about how we can use the Batch API to import data into CDP:

In this article, I would like to talk about the errors that I came across while implementing the Batch API to import user data into the CDP. Before that, I would like you to check the Sitecore documentation for the Guest Data Model so that you can get the context for the errors listed below:

https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform–data-model-2-1/sitecore-cdp-guest-data-model-for-batch-api.html

Error 1: Not enough identifying information

This comes when the identifiers attribute is missing in the model. So, make sure to set the identity rules in the CDP environment and send it in the model when you are using the Batch API.

Here is the example:

"identifiers":[
         {
            "provider":"loyalty_id",
            "id":"123456789"
         }
      ],

Error 2: guestType missing

In my case, the import was successful but I could not find the guest in the system. After many failed attempts, I noticed the description of the guestType attribute in the documentation – “A required Sitecore CDP attribute that represents the level of identity obtained”. In my model, it was missing. When I added that attribute and imported the data again, the import was successful and I was able to see the guest in the system.

Error 3: Failed to parse import line

This comes when the type of one of the attributes of the guest model is incorrect. In my case, I was trying to import the address of users. There are different attributes for storing address details and those are street, city, state, country, and postcode. As per the documentation, the type of street is a JSON array of strings. However, I was sending the value of the street attribute as a string. It was incorrect. So, make sure you are sending the data in the correct format for all attributes.

Error 4: country is invalid: not a valid ISO 3166-1 Alpha-2 Country Code

As per the documentation, the type of country attribute is string and expected value is 2 letter ISO 3166-1 Alpha-2 country code. I completely missed this detail and sent the country name as a value of country attribute. So, also make sure that you are sending the expected value for an attribute in the correct format.

Error 5: Entity: Guest, Attribute: extensions[0] is invalid: extensions[loyalty]

The type of extensions attribute is JSON array of JSON objects. So, we can send more than one extension object. When I was working on a PoC, I created an extension object with the values of Name and Key attributes as “loyalty” and “flyWithMe” respectively but it failed. Then, I tried to send the extensions data with “ext” and “default” as values of Name and Key attributes and it worked. However, it is not mentioned anywhere that the values should be “ext” and “default”. In the documentation as well, those are referred as example values -https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform–data-model-2-1/sitecore-cdp-guest-extensions-data-model-for-rest-api.html . I am yet to explore in this direction but if you have any details or more information, would be happy to connect or chat.

So, these were the errors that I came across. I would like to hear from you as well if you faced any such issues.

Happy Sharing!

Leave a comment