'Error 404 in my api from MAILCHIMP API returns 404
I am making a project on Newsletter of web development by angela Yu and a project of NewsLetter is going on in which I got 404 error which includes API from The MAILCHIMP website and when I put the api inside it and everytime it is howing error 404
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)
{
var firstName = req.body.fName;
var lastName = req.body.lName;
var email = req.body.email;
var data = {
members: [
{email_address: email,
status: "subscribed"
}
]
};
var jsondata = JSON.stringify(data);
var options={
url: "https://us18.mailchimp.com/3.0/lists/3328c667f4",
method:"POST",
headers: {
"Authorization" : "removed"
},
body: jsondata
};
// console.log(firstName,lastName,email);
request(options,function(error,response,body)
{
if(error)
{
console.log(error);
}
else{
console.log(response.statusCode);
}
});
});
app.listen(3000,function()
{
console.log("Server is listening on port 3000");
})
Solution 1:[1]
There can be quite a few scenarios where you may face the 404 not found error.
Follow this blog that describes those scenarios and how to resolve them.
Your case:
You are trying to access a list which is might be identified by the ID 3328c667f4.
This list is a resource. There is a possibility that this resource has been deleted or moved to any other location.
The webserver could not find it on the specified URL and that is why you get 404 not found error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Deepak Tatyaji Ahire |
