The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

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

SOLVED
Go to solution
Highlighted
Member

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 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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

View solution in original post

1 REPLY 1
Highlighted
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

View solution in original post

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured