1

I am sending a post request to the GetResponse API. Everything works fine until I add a custom field (customFieldValues) to save along with my new email contact.

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

When I send the request I get the following error message:

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

I have tried a few things now and not sure how to format this properly to have the API accept it.

Reference link: http://apidocs.getresponse.com/v3/case-study/adding-contacts

Alexey Shokov
  • 4,775
  • 1
  • 21
  • 22
Chris
  • 764
  • 1
  • 10
  • 24

2 Answers2

1

I found the solution on github in an example for their php api here:

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

I suppose I had to wrap an array inside an array inside of an array...geez:

'customFieldValues' => array(
        array('customFieldId' => 'custom_field_id_obtained_by_API',
            'value' => array(
                'Y'
            )),
         array('customFieldId' => 'custom_field_id_obtained_by_API',
            'value' => array(
                'Y'
            ))
    )
Chris
  • 764
  • 1
  • 10
  • 24
0

For GetResponse V3

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

Please note the 'name' field is optional. The site sampled is an international scholarship platform.

Albert A
  • 469
  • 4
  • 9