cancel
Showing results for 
Search instead for 
Did you mean: 
Tomorrow morning (8/26) from 07:00 AM - 08:00 AM ET we need to make a few updates to our site. During this time, no emails will be sent and some customers will not be able to access their contacts. We recommend finishing up your work before 07:00 AM and logging in after 08:00 AM ET. Thank you for your patience while we make these updates.

Re: Property was found but is not permitted at this location. #customfields

SOLVED
Highlighted
All Star

Re: Property was found but is not permitted at this location. #customfields

If I am using the basic API v2 PHP example, addOrUpdateContact.php and I want to add the value of a radio input to a custom field named CustomField1, can I not just post like so?

 

            $contact = new Contact();
            $contact->addEmail($_POST['email']);
            $contact->addList($_POST['list']);
            $contact->first_name = $_POST['first_name'];
            $contact->last_name = $_POST['last_name'];
            $contact->CustomField1 = $_POST['CustomField1'];

When I try that, I receive the error.

How do I post to CustomField1?

I have limited knowledge of PHP and/or this API but this seems too simple to not work.

1 REPLY 1
Moderator

Re: Property was found but is not permitted at this location. #customfields

Hello,

 

Thank you for reaching out to Constant Contact developer support.

 

There is a custom field array that then contains each custom field within it as a sub-object. This is the same way that lists work on contact objects. See below:

$contact->custom_fields = [
[
"name"=>"CustomField1",
"Value"=>$_POST['CustomField1']
],
[
"name"=>"CustomField2",
"Value"=>$_POST['CustomField2']
]
];


Regards,
David B.
Tier II API Support Engineer