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;








1















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.










share|improve this question




























    1















    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.










    share|improve this question
























      1












      1








      1








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 16:59









      PauloPaulo

      361 silver badge6 bronze badges




      361 silver badge6 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          3














          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());





          share|improve this answer

























          • 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










          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
          );



          );













          draft saved

          draft discarded


















          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









          3














          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());





          share|improve this answer

























          • 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















          3














          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());





          share|improve this answer

























          • 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













          3












          3








          3







          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());





          share|improve this answer















          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());






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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








          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.



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript