Constant Contact Logo
Community Home
Resources
  • "Ask a Trainer" Sessions
  • Getting Started
  • Help Center
  • News and Announcements
  • Professional Services
  • Support Forum
Events & Webinars
  • On-Demand Webinars
  • Upcoming Webinars
Learn
  • Be A Marketer
  • Campaign Feedback
  • Community Blog
  • Community Coaches
  • Email Design Tips
  • Marketing Strategies
Groups
  • Nonprofit
  • Real Estate
  • Retail & Ecommerce
  • Small Business Voices
  • The ANZ Hub
Product Ideas
  • Sign up free
  • Log in
  • Constant Contact Community
  • >
  • About KentH846

About KentH846

KentH846
KentH846
Rookie
since ‎01-05-2020
‎01-08-2020
1
Post
0
Kudos
0
Solutions
Badges
First Topic
View All
Latest Contributions by KentH846
  • Topics KentH846 has Participated In
  • Latest Contributions by KentH846

400 Status Code — Bad Request

by KentH846 in API Developer Support
‎01-07-2020 10:18 AM
‎01-07-2020 10:18 AM
Hello I am new to setting up email API. I am struggling to make this work with Constant Contact. I am using node.js with Express, and using Request as my HTTP client. Something is not configured correctly in my options or the data I am using to make the post request. My form has three inputs: First Name, Last Name and Email. Can someone with knowledge of this approach help me out? Thank you   const express = require("express"); const bodyParser = require("body-parser"); const request = require("request"); const app = express(); app.use(express.static("public")); app.use(   bodyParser.urlencoded({     extended: true   }) ); app.get("/", function(req, res) {   res.sendFile(__dirname + "/signup.html"); }); app.post("/", function(req, res) {   let firstName = req.body.fName;   let lastName = req.body.lName;   let email = req.body.email;   let data = {     first_name: firstName,     last_name: lastName,     email_address: email   };   let jsonData = JSON.stringify(data);   let options = {     url:       "https://api.constantcontact.com/v2/lists?api_key=xxxxxx",     method: "POST",     headers: {       Authorization: "Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"     },     body: jsonData   };   request(options, function(error, response, body) {     console.log(response.statusCode);   }); }); app.listen(3000, function() {   console.log("server has started on port 3000"); });   *moderator note: edited content for privacy ... View more
  • Tags:
  • express
  • node
  • node.js
  • Request
Latest Tags
  • express
  • node
  • node.js
  • Request
View All
  • © Constant Contact, Inc. 1996-2025
  • Terms
  • Community Terms
  • Community Guidelines
  • Privacy
  • Vulnerability Disclosure