Not sure if anyone on here has worked with Constant Contact but I thought I would give it a shot. I am trying to upload contacts to their system via their API. All is fine until I try using what they call "Custom Fields". I can upload their predefined fields: First Name, Last Name, Email, etc... but I want to add a "Custom Field" to add our Customer Number.
Currently for testing I've created 1 custom fields labeled: 'custom_field_1' per their documentation.
This is the error I get when trying to add contacts with Custom Fields:
 => stdClass Object
[error_key] => json.type.invalid
[error_message] => #/custom_fields: Value is of a disallowed type. Allowed types are: Array, Null.
Here is what I've tried:
// $custFPre = ['name' => 'custom_field_1', 'value' => '12345'];
// $custF = json_encode($custFPre);
$custF = '"custom_fields": [
$contact = new Contact();
$contact->first_name = $_POST['first_name'];
$contact->last_name = $_POST['last_name'];
$contact->custom_fields = $custF;
You'll see I tried 2 different ways of adding the custom field with JSON.
Here is their guide:
I appreciate any thought/suggestions or if anyone else has run into this same issue.