【问题标题】:Using Guzzle with GetResponse API to save custom field?使用 Guzzle 和 GetResponse API 来保存自定义字段?
【发布时间】:2017-10-19 00:14:51
【问题描述】:

我正在向 GetResponse API 发送一个发布请求。一切正常,直到我添加一个自定义字段 (customFieldValues) 以与我的新电子邮件联系人一起保存。

 $body_data = 
            [
                'name' => $input['name'],
                'email' => $input['email'],
                'campaign' => [
                    'campaignId' => $campaign_id
                ],
                'customFieldValues' => ['customFieldId' => 'LDe0h', 'value' => ['Save this test string.'] ]
            ];

当我发送请求时,我收到以下错误消息:

"errorDescription": "CustomFieldValue entry must be specified as array"

我现在已经尝试了一些方法,但不确定如何正确格式化以让 API 接受它。

参考链接: http://apidocs.getresponse.com/v3/case-study/adding-contacts

【问题讨论】:

    标签: php api getresponse


    【解决方案1】:

    我在 github 上的 php api 示例中找到了解决方案:

    https://github.com/GetResponse/getresponse-api-php

    我想我必须将一个数组包装在一个数组内的数组内...天哪:

    'customFieldValues' => array(
            array('customFieldId' => 'custom_field_id_obtained_by_API',
                'value' => array(
                    'Y'
                )),
             array('customFieldId' => 'custom_field_id_obtained_by_API',
                'value' => array(
                    'Y'
                ))
        )
    

    【讨论】:

      【解决方案2】:

      对于 GetResponse V3

          'customFieldValues' => [
             'customFieldId' => 'custom_field_id_from_API',
             'name' => 'Website',
             'value' => ['https://scholarshipspsy.com']    
          ]
      

      请注意,“姓名”字段是可选的。抽样网站是一个international scholarship 平台。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-05-17
        • 2023-03-28
        • 2020-12-14
        • 1970-01-01
        • 2023-03-12
        • 2012-11-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多