# Running Collection with Json body file working fine, Newman having problem

**URL:** <https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194>\
**Category:** Help Hub\
**Tags:** newman-project, json\
**Created:** [April 4, 2022, 9:17am UTC](https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194 "2022-04-04T09:17:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fathalla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/fathalla/32/11641_2.png) [@Fathalla](https://community.postman.com/u/Fathalla)\
**Post date:** [April 4, 2022, 9:17am UTC](https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194/1 "2022-04-04T09:17:52Z")

</div>

I have postman collection that is running perfect that sending the complete file json as body of the request by running it and selecting the json file.  
but when executing with Newman is not working fine, I am putting the -d filename with it giving me error 401 (same as running the collection without selecting the file).  
any help please.  
what I am missing here?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/2/3/239e29c46ef0b1e03ffe956afc4250f7ca82f09b.jpeg)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/c/acd10bf2320481e1fd1d4d306e5721e28d64bf9a.jpeg)

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [April 4, 2022, 9:29am UTC](https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194/2 "2022-04-04T09:29:05Z")

</div>

Hi @Fathalla

This thread looks like it answers your question…

> [@Accessing global variables when running collection using Newman](https://community.postman.com/t/accessing-global-variables-when-running-collection-using-newman/11133/2):
>
> Hi, @dcarva! Welcome. Globals can be passed as a command line parameter, either as a JSON file path/URL (via --globals) or individually (via --global-var). See here: [https://github.com/postmanlabs/newman/#newman-run-collection-file-source-options](https://github.com/postmanlabs/newman/#newman-run-collection-file-source-options).

---

<div class="post-metadata">

**Author:** ![Fathalla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/fathalla/32/11641_2.png) [@Fathalla](https://community.postman.com/u/Fathalla)\
**Post date:** [April 4, 2022, 9:54am UTC](https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194/3 "2022-04-04T09:54:29Z")

</div>

Thanks.  
I added the variable in the environment,  
export it,  
and executed with the -e Environment along with the -d File

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/a/0a522dcaf9daa3b3fe6a1da428b2d660a7f86519.jpeg)  
still having problem.  
which variables missing?

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [April 4, 2022, 10:13am UTC](https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194/4 "2022-04-04T10:13:16Z")

</div>

whats the full command you run for newman?

---

<div class="post-metadata">

**Author:** ![Fathalla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/fathalla/32/11641_2.png) [@Fathalla](https://community.postman.com/u/Fathalla)\
**Post date:** [April 4, 2022, 6:51pm UTC](https://community.postman.com/t/running-collection-with-json-body-file-working-fine-newman-having-problem/34194/6 "2022-04-04T18:51:28Z")

</div>

Thanks its worked I don’t know why I have to send the request twice, one failed, the other one succeeded !
