# How to Assert values while doing POST or PUT .They dont have any values in response body other than "SUCCESS"

**URL:** <https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [July 20, 2021, 9:23am UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917 "2021-07-20T09:23:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![orbital-module-pilo1](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@orbital-module-pilo1](https://community.postman.com/u/orbital-module-pilo1)\
**Post date:** [July 20, 2021, 9:23am UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917/1 "2021-07-20T09:23:13Z")

</div>

How to Assert while doing POST or PUT .They dont have any response body .  
Also if some one could explain how to assert against MongoDB values

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [July 20, 2021, 10:06am UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917/2 "2021-07-20T10:06:02Z")

</div>

Hey @orbital-module-pilo1

Welcome to the community! 👋

It’s going to be really tricky for anyone to provide an answer, given the details in your question. 😢

Could you take a look through this thread [How to Best Ask Questions on Community to Get the Answers You Need](https://community.postman.com/t/how-to-best-ask-questions-on-community-to-get-the-answers-you-need/16912) and edit your question to provide more information and context, please.

---

<div class="post-metadata">

**Author:** ![orbital-module-pilo1](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@orbital-module-pilo1](https://community.postman.com/u/orbital-module-pilo1)\
**Post date:** [July 21, 2021, 10:36pm UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917/3 "2021-07-21T22:36:53Z")

</div>

Hi Danny ,

Thank you for the feedback .What I am really looking is how to assert POSTed value to MongoDB  
All most all ,assert happens against the Response Body .If the API call does not yield any response body , my understanding is ,only solution is to connect to DB and see if the POST was successful .I might be wrong .I am new to API test using POSTMAN , so any help would be appreciated .

Example POST  
**Body :**  
{

“GroupName”: “{{GroupName}}”,  
“Description”: “Test Group”  
}

\*\*Environment Variable \*\*  
GroupName

**pre script:**  
var random=Math.random().toString(36).substring(2);

var GroupName=“madhu”+random+“group”;

pm.environment.set(“GroupName”,GroupName);

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [July 24, 2021, 6:14am UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917/4 "2021-07-24T06:14:56Z")

</div>

See if there is an endpoint to retrieve those data , if so first post it and validate status code and then do a get to the end point to get new values and assert that

---

<div class="post-metadata">

**Author:** ![cruxto](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@cruxto](https://community.postman.com/u/cruxto)\
**Post date:** [July 24, 2021, 1:02pm UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917/5 "2021-07-24T13:02:57Z")

</div>

> [@orbital-module-pilo1](#):
>
> my unerstanding is ,only solution is to connect to DB and see if the POST was successful .I

Hi @orbital-module-pilo1, You can also do assertions against the Request too, but I’m not sure how much value that will have for you.

If you wrote a test that asserts that GroupName property is in the request, it would always pass.  
Look at pm.request.body object to access the request data. This is something I’ve used recently myself.

If you are using mongo atlas, then they have a product called [mongo stitch](https://www.mongodb.com/blog/post/start-here-a-video-introduction-to-mongodb-stitch) which allows you to create a rest endpoint to check data has actually reached the database. Which would probably be more valuable to you.

---

<div class="post-metadata">

**Author:** ![orbital-module-pilo1](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@orbital-module-pilo1](https://community.postman.com/u/orbital-module-pilo1)\
**Post date:** [July 27, 2021, 4:24am UTC](https://community.postman.com/t/how-to-assert-values-while-doing-post-or-put-they-dont-have-any-values-in-response-body-other-than-success/25917/6 "2021-07-27T04:24:21Z")

</div>

Hi cruxto ,

I found solution in using **pm.sendRequest** in the _test_ and doing validation against the response.json().That solved the no response body issue.  
Yes, iam using mongo atlas.Thank you for the info abt mongo stitch i will explore on that .
