Creating a list from javascript

Highlighted
New Member

Creating a list from javascript

I am trying to create a list as described here: http://community.constantcontact.com/t5/Documentation/API-Quick-Reference/ba-p/36047, where it says you can create a list by posting to /lists. It does not give a lot of detail but it does say you need to post, not get.

 

So I am posting to 

https://api.constantcontact.com/ws/customers/%7Bemsegal%7D/lists?access_token=abc_I_Put_My_App_Token...

 

with the name of the list posted as Name. However, I get back this error: 

 

HTTP Status 403 - Not Allowed to access {emsegal}


type Status report

message Not Allowed to access {emsegal}

description Access to the specified resource (Not Allowed to access {emsegal}) has been forbidden.

 

Maybe I am doing this whole thing the wrong way. But I would like to do this using javasript, and I would like to avoid putting together an XMLDOM and posting it. Can anyone help me just create a list with javascript?

 

PS I am not trying to add names right now, just create a list.


2 REPLIES 2
Highlighted
New Member

Re: Creating a list from javascript

When I tried taking my name out of the curly brackets in the url, I posted to this address:

https://api.constantcontact.com/ws/customers/emsegal/lists?access_token=blahBlahBlah

and got this error

 

Error 415: Content type: 'application/x-www-form-urlencoded' is not accepted by this collection. Accepted type(s) are: 'application/atom+xml;type=entry'.
Highlighted
Moderator

Re: Creating a list from javascript

Our API request you to send a full body XML document to create a list, found here: http://community.constantcontact.com/t5/Documentation/Creating-a-New-List/ba-p/25069

 

There are numberous problems using an Authenticated REST API through JavaScript, most of which are assoicated with Cross Site Scripting issues.  It may be possible to get a successful list creation through JavaScript, but it will be impossible to pull information back from a 3rd party domain due to XSS security protections in browsers.  We recommend using a server side language to make sure that you are able to fully use the API without any security issues.

 

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured