How to get API post request with json dataWhat's the difference between a POST and a PUT HTTP REQUEST?JavaScript post request like a form submitDetecting request type in PHP (GET, POST, PUT or DELETE)How do I get started with Node.jsHow to make HTTP POST web requestHow do I send a POST request with PHP?How to retrieve POST query parameters?How is an HTTP POST request made in node.js?How are parameters sent in an HTTP POST request?The JSON data in request body is not getting parsed using body-parser
How acidic does a mixture have to be for milk to curdle?
Time travel novel: machine makes clones, clones battle to be the one to get back their life
Can the Artificer's infusions stack? Returning weapon + radiant weapon?
Does academia have a lazy work culture?
How did C64 games handle music during gameplay?
Iterate over non-const variables in C++
How do I generate distribution of positive numbers only with min, max and mean?
What does "see" in "the Holy See" mean?
How to judge a Ph.D. applicant that arrives "out of thin air"
Is dd if=/dev/urandom of=/dev/mem safe?
Why are off grid solar setups only 12, 24, 48 VDC?
Why is a dedicated QA team member necessary?
Replacing tongue and groove floorboards: but can't find a match
What does Kasparov mean by "I was behind in three and even in one after six games"?
kids pooling money for Lego League and taxes
How do we explain the E major chord in this progression?
Is my employer paying me fairly? Going from 1099 to W2
How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?
What exactly makes a General Products hull nearly indestructible?
Why isn't there a serious attempt at creating a third mass-appeal party in the US?
Memory capability and powers of 2
How do professional electronic musicians/sound engineers combat listening fatigue?
How do campaign rallies gain candidates votes?
TSA asking to see cell phone
How to get API post request with json data
What's the difference between a POST and a PUT HTTP REQUEST?JavaScript post request like a form submitDetecting request type in PHP (GET, POST, PUT or DELETE)How do I get started with Node.jsHow to make HTTP POST web requestHow do I send a POST request with PHP?How to retrieve POST query parameters?How is an HTTP POST request made in node.js?How are parameters sent in an HTTP POST request?The JSON data in request body is not getting parsed using body-parser
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm triyng to make an API request using postman and body raw data, but I can't read the data on server side.
My request:
http://prntscr.com/n38hes
http://prntscr.com/n38hq9
I've already tried:
app.post('/test', function (req, res)
console.log(req.query)
)
and:
app.post('/test', function (req, res)
console.log(req.body)
)
but both of them prints
I would like to obtain the username and the password for the request I made using postman.
node.js api post request
add a comment |
I'm triyng to make an API request using postman and body raw data, but I can't read the data on server side.
My request:
http://prntscr.com/n38hes
http://prntscr.com/n38hq9
I've already tried:
app.post('/test', function (req, res)
console.log(req.query)
)
and:
app.post('/test', function (req, res)
console.log(req.body)
)
but both of them prints
I would like to obtain the username and the password for the request I made using postman.
node.js api post request
add a comment |
I'm triyng to make an API request using postman and body raw data, but I can't read the data on server side.
My request:
http://prntscr.com/n38hes
http://prntscr.com/n38hq9
I've already tried:
app.post('/test', function (req, res)
console.log(req.query)
)
and:
app.post('/test', function (req, res)
console.log(req.body)
)
but both of them prints
I would like to obtain the username and the password for the request I made using postman.
node.js api post request
I'm triyng to make an API request using postman and body raw data, but I can't read the data on server side.
My request:
http://prntscr.com/n38hes
http://prntscr.com/n38hq9
I've already tried:
app.post('/test', function (req, res)
console.log(req.query)
)
and:
app.post('/test', function (req, res)
console.log(req.body)
)
but both of them prints
I would like to obtain the username and the password for the request I made using postman.
node.js api post request
node.js api post request
asked Mar 26 at 16:59
PauloPaulo
361 silver badge6 bronze badges
361 silver badge6 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Make sure you have body parser configured.
var bodyParser = require('body-parser');
//here app is express app
app.use(bodyParser.urlencoded(
extended: true
));
app.use(bodyParser.json());
Still doesn't work.
– Paulo
Mar 26 at 17:34
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
what do you mean by that?
– Paulo
Mar 26 at 17:57
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362521%2fhow-to-get-api-post-request-with-json-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Make sure you have body parser configured.
var bodyParser = require('body-parser');
//here app is express app
app.use(bodyParser.urlencoded(
extended: true
));
app.use(bodyParser.json());
Still doesn't work.
– Paulo
Mar 26 at 17:34
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
what do you mean by that?
– Paulo
Mar 26 at 17:57
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
|
show 3 more comments
Make sure you have body parser configured.
var bodyParser = require('body-parser');
//here app is express app
app.use(bodyParser.urlencoded(
extended: true
));
app.use(bodyParser.json());
Still doesn't work.
– Paulo
Mar 26 at 17:34
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
what do you mean by that?
– Paulo
Mar 26 at 17:57
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
|
show 3 more comments
Make sure you have body parser configured.
var bodyParser = require('body-parser');
//here app is express app
app.use(bodyParser.urlencoded(
extended: true
));
app.use(bodyParser.json());
Make sure you have body parser configured.
var bodyParser = require('body-parser');
//here app is express app
app.use(bodyParser.urlencoded(
extended: true
));
app.use(bodyParser.json());
edited Mar 26 at 18:06
answered Mar 26 at 17:11
Manish KumawatManish Kumawat
1,0202 gold badges8 silver badges18 bronze badges
1,0202 gold badges8 silver badges18 bronze badges
Still doesn't work.
– Paulo
Mar 26 at 17:34
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
what do you mean by that?
– Paulo
Mar 26 at 17:57
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
|
show 3 more comments
Still doesn't work.
– Paulo
Mar 26 at 17:34
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
what do you mean by that?
– Paulo
Mar 26 at 17:57
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
Still doesn't work.
– Paulo
Mar 26 at 17:34
Still doesn't work.
– Paulo
Mar 26 at 17:34
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
@Paulo are you having both post methods in code?
– Manish Kumawat
Mar 26 at 17:39
what do you mean by that?
– Paulo
Mar 26 at 17:57
what do you mean by that?
– Paulo
Mar 26 at 17:57
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
@Paulo In your example, you have described 2 approaches. Do you have both them in running code? or you are trying one at a time?
– Manish Kumawat
Mar 26 at 17:59
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
I'm trying one at a time, but I tested both approaches
– Paulo
Mar 26 at 18:02
|
show 3 more comments
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362521%2fhow-to-get-api-post-request-with-json-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown