我们如何使用Marketo REST API针对潜在客户记录自定义活动数据?

时间:2018-03-19 11:53:54

标签: marketo

我们已经使用Marketo门户创建了一个自定义活动,我们可以使用REST API创建潜在客户。那么现在,我们如何使用Marketo REST API记录自定义活动数据? 自定义活动结构如下:

{
    "id": 100001,
    "name": "TEST_ACTIVITY",
    "apiName": "test_api_c",
    "description": "",
    "primaryAttribute": {
        "name": "event_id",
        "apiName": "event_id",
        "dataType": "string"
    },
    "attributes": [
        {
            "name": "email",
            "apiName": "email",
            "dataType": "email"
        },
        {
            "name": "event_data",
            "apiName": "event_data",
            "dataType": "string"
        }
    ]
}

1 个答案:

答案 0 :(得分:1)

您可以将自定义活动记录推送到Add Custom Activities端点,POST /rest/v1/activities/external.json网址上提供该端点。

首先,值得注意的是,为了使用端点,API用户必须具有“读写活动”权限。
端点期望具有单个input密钥的有效负载,最多可容纳300个活动记录。对于每个活动记录, leadId activityDate activityTypeId primaryAttributeValue 属性字段是必需的,如果是属性数组,name是普通的“名称”字段,而不是“apiName”。

在您的情况下,有效负载看起来像这样:

{  
    "input":[// Note the array of records
        {
            "activityDate":"2018-03-20T22:43:12+02:00",
            "activityTypeId":100001,
            "leadId":<LEAD_ID>,
            "primaryAttributeValue":"<YOUR_EVENT_ID>",
            "attributes":[
                {
                    "name":"email",// This is the `name` field of the attribute, not the `apiName`!
                    "value":"<EMAIL_ADDRESS>"
                },
                {
                    "name":"event_data",// This is the `name` field of the attribute, not the `apiName`!
                    "value":"<EVENT_DATA>"
                }
            ]
        },
        //{
        //  …other activity records…
        //}
    ]
}