# How do I test for required and non-required fields in the request, in one test? I need to test for Headers and Body

**URL:** <https://community.postman.com/t/how-do-i-test-for-required-and-non-required-fields-in-the-request-in-one-test-i-need-to-test-for-headers-and-body/47551>\
**Category:** Help Hub\
**Created:** [May 17, 2023, 10:26am UTC](https://community.postman.com/t/how-do-i-test-for-required-and-non-required-fields-in-the-request-in-one-test-i-need-to-test-for-headers-and-body/47551 "2023-05-17T10:26:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscarmuk](https://avatars.discourse-cdn.com/v4/letter/o/ea5d25/32.png) [@oscarmuk](https://community.postman.com/u/oscarmuk)\
**Post date:** [May 17, 2023, 10:26am UTC](https://community.postman.com/t/how-do-i-test-for-required-and-non-required-fields-in-the-request-in-one-test-i-need-to-test-for-headers-and-body/47551/1 "2023-05-17T10:26:05Z")

</div>

Here is the body

{  
“someidentification”: {  
“acc”: “string”,  
“ref”: “number”  
},  
“someCategory”: [  
{  
“catCode”: “string”,  
“req”: “boolean”  
}  
],  
“name”: “string”  
}

acc, ref and catCode are required

error message will contain e.g. “message”: “body/someidentification must have required property ‘ref’”

---

<div class="post-metadata">

**Author:** ![oscarmuk](https://avatars.discourse-cdn.com/v4/letter/o/ea5d25/32.png) [@oscarmuk](https://community.postman.com/u/oscarmuk)\
**Post date:** [May 19, 2023, 1:03pm UTC](https://community.postman.com/t/how-do-i-test-for-required-and-non-required-fields-in-the-request-in-one-test-i-need-to-test-for-headers-and-body/47551/2 "2023-05-19T13:03:12Z")

</div>

Anyone? Is this the right place to post this?

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [May 22, 2023, 11:46am UTC](https://community.postman.com/t/how-do-i-test-for-required-and-non-required-fields-in-the-request-in-one-test-i-need-to-test-for-headers-and-body/47551/3 "2023-05-22T11:46:08Z")

</div>

Have a look at the following.

[JSON Schema Validation in Postman (softwaretestingmaterial.com)](https://www.softwaretestingmaterial.com/json-schema-validation-in-postman/)
