cancel
Showing results for 
Search instead for 
Did you mean: 
Constant Contact wants to help you succeed! We’re celebrating our professional service programs on the Constant Contact Community this month and you have a chance to try one of the services for free! Learn more.

Property was found but is not permitted at this location

SOLVED
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.

 

4 REPLIES 4
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
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.

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

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.