# All values undefined in POST requests

**URL:** <https://community.postman.com/t/all-values-undefined-in-post-requests/27295>\
**Category:** Help Hub\
**Tags:** post\
**Created:** [August 30, 2021, 3:48pm UTC](https://community.postman.com/t/all-values-undefined-in-post-requests/27295 "2021-08-30T15:48:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![npiombino](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/npiombino/32/9631_2.png) [@npiombino](https://community.postman.com/u/npiombino)\
**Post date:** [August 30, 2021, 3:48pm UTC](https://community.postman.com/t/all-values-undefined-in-post-requests/27295/1 "2021-08-30T15:48:09Z")

</div>

Hello all, I’m brand new to APIs and Postman. I can’t seem to get the data from my POST request to my console.

Copious googling revealed that there are some changes to bodyParser that could be the problem, but I believe I have current/valid code for that now.

My request:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/3/37bea9dd83a2e11d98dfe36d244c1a39c3f60fd1.png)

My app.js (2 screen captures due to length):

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/a/ab7ce924be9060bbb2f54c123c9461d03517bc48.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/f/f4e051c405b819f51c765d622078bdd6e16e0592.png)

---

<div class="post-metadata">

**Author:** ![npiombino](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/npiombino/32/9631_2.png) [@npiombino](https://community.postman.com/u/npiombino)\
**Post date:** [August 30, 2021, 3:49pm UTC](https://community.postman.com/t/all-values-undefined-in-post-requests/27295/2 "2021-08-30T15:49:11Z")

</div>

This is the result in the database (number 11), which lacks the data I am trying to pass:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/f/f53dd6902f754db47508e9aeb5a58c995280ba63.png)

---

<div class="post-metadata">

**Author:** ![kitty-garrison](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kitty-garrison/32/27117_2.png) [@kitty-garrison](https://community.postman.com/u/kitty-garrison)\
**Post date:** [August 30, 2021, 5:16pm UTC](https://community.postman.com/t/all-values-undefined-in-post-requests/27295/3 "2021-08-30T17:16:41Z")

</div>

It looks like you are trying to assign your values from the body of the request. For example: `commonName` from `req.body.commonName` However, from the looks of your request in the postman screenshot you are passing the common name in the request parameters instead of the body.

You can do one of two things to get this to work.  
**Either:**  
Change the code to assign from req. **params**.commonName (instead of req. **body**.commonName)  
**or**  
Leave the code as is. THen, remove all the query params and instead use the body to send the values, like this:

```auto
{
"commonName":"new plant",
"scientificName":"lorem ipsum",
"sun":"full",
"type":herb"
}

```

---

<div class="post-metadata">

**Author:** ![npiombino](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/npiombino/32/9631_2.png) [@npiombino](https://community.postman.com/u/npiombino)\
**Post date:** [August 30, 2021, 7:04pm UTC](https://community.postman.com/t/all-values-undefined-in-post-requests/27295/4 "2021-08-30T19:04:27Z")

</div>

Thank you so much for your assistance!

From following your second suggestion, I determined I simply needed to be in the “body” tab rather than the “params” tab when I was entering the key: value pairs.

Thanks again for helping a clueless newcomer!
