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.

Property was found but is not permitted at this location

SOLVED
Go to solution
Highlighted
Occasional Participant

Property was found but is not permitted at this location

Hello.

I am trying to integrate form on my client's website with ConstantContact, and I am getting this error:

Property was found but is not permitted at this location.

I have no idea what can cause this issue. Here are some details:

-I am using your newest SDK.

-Same error occured if I try to submit from localhost or from live server.

Any help?

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Advisor

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

Hello,

 

It looks like the property 'name' was added to the Contact object.  That is not a valid property name in the JSON version of the Contact object.  Is that handled somewhere else in the code?

 

Andrew B.

API Support

View solution in original post

4 REPLIES 4
Highlighted
Moderator

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

Can you share more information such as which SDK, which call you're making and potentially a code snippet?

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

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

Hello, Dave and thank you for your reply, I appreciate that.

I am using PHP SDK, downloaded from this location:

https://github.com/constantcontact/php-sdk

I have problem in custom Joomla module, which I made. Core of that module is slightly modified file "addOrUpdateContact.php" from "Examples" folder of SDK.

I splitted code into 2 parts. Here is PHP part:

 

 

$api_key = $params->get('api_key');
$access_token = $params->get('access_token');

require_once 'src/Ctct/autoload.php';

use Ctct\ConstantContact;
use Ctct\Components\Contacts\Contact;
use Ctct\Components\Contacts\ContactList;
use Ctct\Components\Contacts\EmailAddress;
use Ctct\Exceptions\CtctException;

define("APIKEY", (string)$api_key);
define("ACCESS_TOKEN", (string)$access_token);

$cc = new ConstantContact(APIKEY);

// check if the form was submitted
if (isset($_POST['email']) && strlen($_POST['email']) > 1) {
    $action = "Getting Contact By Email Address";
    try {
        // check to see if a contact with the email addess already exists in the account
        $response = $cc->getContactByEmail(ACCESS_TOKEN, $_POST['email']);

        // create a new contact if one does not exist
        if (empty($response->results)) {
            $action = "Creating Contact";

            $contact = new Contact();
            $contact->addEmail($_POST['email']);
            $contact->addList($_POST['list']);
            $contact->name = $_POST['name'];
            $returnContact = $cc->addContact(ACCESS_TOKEN, $contact);

        // update the existing contact if address already existed
        } else {
            $action = "Updating Contact";

            $contact = $response->results[0];
            $contact->addList($_POST['list']);
            $contact->name = $_POST['name'];
            $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact);
        }

    // catch any exceptions thrown during the process and print the errors to screen
    } catch (CtctException $ex) {
        echo '<div class="constantcontact_module_error"> '.JText::_('MOD_CONSTANT_ERROR').' '.$action.': ';
        $errors = $ex->getErrors();
        $errors_expl = explode(":", $errors[0]["error_message"]);
        echo $errors_expl[count($errors_expl)-1];
        echo '</div>';
    }
}

 

 

And here is HTML part of the same module:

 

<form name="submitContact" method="POST" id="submitContact">
  <div class="constantcontact_module_form">
    <input type="text" value="Name" name="name" class="inputbox" onblur="if(this.value=='') this.value='Name';" onfocus="if(this.value == 'Name') this.value = '';" id="name">
    <input type="text" value="Email address" name="email" class="inputbox" onblur="if(this.value=='') this.value='Email address';" onfocus="if(this.value == 'Email address') this.value = '';" id="email">
    <input type="submit" name="Submit" value="SIGN UP" class="subbutton btn btn-primary" onclick="return false">
    <input type="hidden" name="list" value="1190817546">
  </div>
</form>

 

 

I am using exactly the same module on other website (http://richesrides.com) and everything works like a charm there, with exactly the same module. But, same module installed on site http://nalcs.org generate error as I described.

 

Thank you again for your interests for my problem.

Best regards,

Dejan.

Highlighted
Regular Advisor

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

Hello,

 

It looks like the property 'name' was added to the Contact object.  That is not a valid property name in the JSON version of the Contact object.  Is that handled somewhere else in the code?

 

Andrew B.

API Support

View solution in original post

Highlighted
Occasional Participant

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

There was the problem. Design of module required only 2 fields, "Name" and "Email", now I see that client use property "last_name" for column "Name".

Now I have the answer why same code works on other site (richesrides.com), right..? Because module on that site use default fields "First name" and "Last name", just like your Contact object require.

Thank you for your time, both of moderators, and you Andrew for solution.

Best regards,

Dejan.

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