# How to get/set id for pm.sendRequest before executed?

**URL:** <https://community.postman.com/t/how-to-get-set-id-for-pm-sendrequest-before-executed/42618>\
**Category:** Help Hub\
**Tags:** newman-project, collections\
**Created:** [January 5, 2023, 2:19pm UTC](https://community.postman.com/t/how-to-get-set-id-for-pm-sendrequest-before-executed/42618 "2023-01-05T14:19:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ad6885971](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@ad6885971](https://community.postman.com/u/ad6885971)\
**Post date:** [January 5, 2023, 2:19pm UTC](https://community.postman.com/t/how-to-get-set-id-for-pm-sendrequest-before-executed/42618/1 "2023-01-05T14:19:43Z")

</div>

I want to execute multiple pm.sendRequest and record their id, so that I can map the responses.  
Where I can get or set the response id after executed pm.sendRequest?

---

<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:** [January 5, 2023, 3:29pm UTC](https://community.postman.com/t/how-to-get-set-id-for-pm-sendrequest-before-executed/42618/2 "2023-01-05T15:29:56Z")

</div>

The sendRequest method has options for error handing and the response.

In the following example, the response is being saved within the variable “res”.

Which is then parsed as you would normally do.

```auto
  pm.sendRequest({
      url: 'https://postman-echo.com/get?test=123,
      method: 'GET',
   }, function (err, res) {
      if (err) {
          console.log(err);
      } else {

          pm.test("Status code is 200", () => {
              pm.expect(res).to.have.status(200);
          });
          
          let response = res.json();
          console.log(response);
          
      }
  });

```
