Please help I tried to do this exactly like the API documentation.... Is there anything im missing or not adding. I of course get the 400 error. Thanks privatevoid btn_ContactEmailSubmit_Click(object sender, EventArgs e) { if (txtbox_ContactEmail != null) { string NewListName = txtbox_ContactEmail.Text; string Resource = API_RESOURCE_CONTACTS; string Url = String.Format("https://api.constantcontact.com/ws/customers/{0}/{1}", API_USERNAME, Resource); CredentialCache CredentialCache = newCredentialCache(); CredentialCache.Add( newUri(Url), "Basic", newNetworkCredential(API_KEY + "%" + API_USERNAME, API_PASSWORD)); try { XDocument NewContact = newXDocument ( newXDeclaration("1.0", "utf-8", "no"), newXElement ( Atom + "entry", newXAttribute("xmlns", "http://www.w3.org/2005/Atom"), newXElement(Atom + "title=\"text\"", "" ), newXElement(Atom + "updated", "2011-09-02"), newXElement(Atom + "author", ""), newXElement(Atom + "id", "data:,none"), newXElement(Atom + "summary", newXAttribute("type=\"text\"", "Contact")), newXElement(Atom + "content", newXAttribute("type", "application/vnd.ctct+xml"), newXElement(ConstantContact + "Contact", newXAttribute("xmlns", "http://ws.constantcontact.com/ns/1.0/"), newXElement(ConstantContact + "EmailAddress", txtbox_ContactEmail.Text), newXElement(ConstantContact + "OptInSource", "ACTION_BY_CUSTOMER"), newXElement(ConstantContact + "ContactLists", newXElement(ConstantContact + "ContactList", newXAttribute("id", "https://api.constantcontact.com/ws/customers/{myusername}/lists/1")) ) ) ) ) ); string Response = NewContact.Post(Url, CredentialCache); MessageBox.Show("You have successfully created a new Contact!"); txtbox_ContactEmail.Clear(); } catch { MessageBox.Show("An Error has occured!"); } } }
... View more