# How to add full Post Raw Body within a Collection Variable to use in the next api call?

**URL:** <https://community.postman.com/t/how-to-add-full-post-raw-body-within-a-collection-variable-to-use-in-the-next-api-call/16361>\
**Category:** Help Hub\
**Created:** [September 30, 2020, 4:39pm UTC](https://community.postman.com/t/how-to-add-full-post-raw-body-within-a-collection-variable-to-use-in-the-next-api-call/16361 "2020-09-30T16:39:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahbaz.shiekhqa](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@shahbaz.shiekhqa](https://community.postman.com/u/shahbaz.shiekhqa)\
**Post date:** [September 30, 2020, 4:39pm UTC](https://community.postman.com/t/how-to-add-full-post-raw-body-within-a-collection-variable-to-use-in-the-next-api-call/16361/1 "2020-09-30T16:39:09Z")

</div>

How to add full Post Raw Body within a Collection Variable to use in the next api call?

I have the POST body parameters:  
{

```
"announcementId": 0,

"header": "Delete Testing slide through API - Header - SS -Time Lapsed should not display",

"body": "Delete Testing slide through API - Body - SS Time Lapsed should not display",

"announcementType": 0,

"imageUrl": "",

"updateDate": "2020-09-22T23:24:10.382Z",

"isAlertBanner": true,

"startDate": "2020-08-29T02:21:22.382Z",

"endDate": "2020-09-20T23:24:10.382Z",

"enabled": true,

"sortOrder": 1

```

}

And i want to add all the values within a collection or environment variable to i can verify after clicking on send, that that is the response that i get in API 2

this is what i got:

let header = JSON.parse(pm.request.body.raw).header;  
pm.environment.set(‘header’,header);

this works for one element within the POST but i want the whole thing.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 1, 2020, 7:57pm UTC](https://community.postman.com/t/how-to-add-full-post-raw-body-within-a-collection-variable-to-use-in-the-next-api-call/16361/2 "2020-10-01T19:57:22Z")

</div>

If you want the whole thing, why not just set your variable to the body?

```auto
pm.environment.set('body', pm.request.body.raw);

```

---

<div class="post-metadata">

**Author:** ![shahbaz.shiekhqa](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@shahbaz.shiekhqa](https://community.postman.com/u/shahbaz.shiekhqa)\
**Post date:** [October 2, 2020, 10:00pm UTC](https://community.postman.com/t/how-to-add-full-post-raw-body-within-a-collection-variable-to-use-in-the-next-api-call/16361/3 "2020-10-02T22:00:36Z")

</div>

Thank you so much that worked perfectly… your awesome … i have a hard issue that i am dealing with if you could help me with this … with your help i have been able to write the loop and array statement but for some reason its not working how i attend it to:

> [@How to grab variable from one API and add it to the endpoint of another api so it is called many times?](https://community.postman.com/t/how-to-grab-variable-from-one-api-and-add-it-to-the-endpoint-of-another-api-so-it-is-called-many-times/16446):
>
> I have two issues that i need help with … In API 1 - i want to loop the response body of GET API and find all the “header” that contain “Delete” When the script finds something that contains “Delete”, grab the announcementid and set it in an array … the code below, is finding the ones that don’t say “Delete”, but the array that should show the announcement ids that have delete in them are not showing i need this to show … var jsonData = pm.response.json(); var resultCount = jso…
