0

I'm using the Fuel REST API contactEvents method to serialize Event data into an Event Data Extension. The following request works:

{
    "contactKey": "susan@sausage.com",
    "eventDefinitionKey": "CONTACT-EVENT-59b53fce-d732-3509-7b12-dc537f8565c3",
    "data": [{
        "key": "MemberPreferences",
        "name": "Member Preferences",
        "id": "84CFE1C6-0345-461E-BF12-1BF346B8407C",
        "items": [{
            "values": [{
                "name": "Preference",
                "value": "frankfurter"
            }]
        }]
    }]
}

Now I note that according to the documentation, I can also omit the contactKey name/value pair from the parent object tree of the request payload and include it as an item in the Event data object (as a ContactKey attribute was added to the Event Data Extension when it was created) as per the following request:

{
    "eventDefinitionKey": "CONTACT-EVENT-59b53fce-d732-3509-7b12-dc537f8565c3",
    "data": [{
        "key": "MemberPreferences",
        "name": "Member Preferences",
        "id": "84CFE1C6-0345-461E-BF12-1BF346B8407C",
        "items": [{
            "values": [
                  {
                     "name":"ContactKey",
                     "value":"susan@sausage.com"
                  },
                  {
                     "name":"Preference",
                     "value":"frankfurter"
                  }
               ]
        }]
    }]
}

This works too. That is, the Event data is serialized into my Events Data Extension and the Contact enters the Interaction.

What I would like to do is to include Event data for multiple Contacts in a single request. That is, if customers sign up for an offer, then rather making individual requests for each Contact (which could be problematic as there is a a soft capped limit of 50,000 requests per day that an app can make), I want to include multiple Contacts in the items array of my request as follows:

{
   "eventDefinitionKey":"CONTACT-EVENT-59b53fce-d732-3509-7b12-dc537f8565c3",
   "data":[
      {
         "key":"MemberPreferences",
         "name":"Member Preferences",
         "id":"84CFE1C6-0345-461E-BF12-1BF346B8407C",
         "items":[
            {
               "values":[
                  {
                     "name":"ContactKey",
                     "value":"susan@sausage.com"
                  },
                  {
                     "name":"Preference",
                     "value":"frankfurter"
                  }
               ]
            },
            {
               "values":[
                  {
                     "name":"ContactKey",
                     "value":"simon@sausage.com"
                  },
                  {
                     "name":"Preference",
                     "value":"bratwurst"
                  }
               ]
            }]
      }]
}

This request returns a successful response, but no records are serialized into the Event Data Extension. Am I doing something wrong here, or isn't this possible?

1

Only one Contact at a time can currently be sent in per ContactEvent request with the API.

In your payload, you include the Attribute Set key, name, and id. You only need to send in one of these 3 values. Key and Id are the safest to send since names can be localized. Since you know all 3 values I would recommend id first, but key would simplify debugging. Always use the name property to ensure the serialization.

     "key":"MemberPreferences", //Easier debugging
     "name":"Member Preferences", //needed for serialization
     "id":"84CFE1C6-0345-461E-BF12-1BF346B8407C", //strongest relationship
  • Hello Kelly, I've discovered that this is actually incorrect. The behavior is as follows: If only id is used, then Event data is not serialized into the Data Extension. If only name is used, then Event data is serialized into the Data Extension. If both id and name is used, then Event data is serialized into the Data Extension. It appears that name is always required. – Eliot Harper Feb 12 '15 at 17:44
  • 1
    I guess you can't always trust what the developer says. I'll update the answer. – Kelly J Andrews Feb 12 '15 at 17:55
  • 1
    Thanks Kelly, that was driving me nuts. I could not figure out why it was not updating. I even tried deleting everything and starting over. But name is definitely required here. Perhaps you can let the developer know this is the case, as I don't think name should be required. – Eliot Harper Feb 12 '15 at 17:57
  • I let them know - name seems like it's not the best requirement, and only id should work. Sorry for the troubles - glad it's working. – Kelly J Andrews Feb 12 '15 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.