I have an array with json data in the below format

```
staff = [
{ "id"   : 1,
   "name" : "Robert"
},
{ "id"   : 2,
   "name" : "Peter"
}
]

```

I am trying to get the designation of these people. There is an API which accepts group of ids. I am trying to get designations in batches of 30. i.e send first 30 objects and get their designations and go on.. I tried keeping a for loop and pass 30 objects but unsuccessful.

Designation API gives data in the below format.

```
[
  {
    "staffId": "26",
    "designation": "PRA"
  },
  {
    "staffId": "25",
    "designation": "MRA"
  }
]

```

Result json

staff = [
 { "id" : 1,
 "name" : "Robert",
 "staffDesignation": "PRA"
 },
 { "id" : 2,
 "name" : "Peter",
 "staffDesignation": "MRA"
 }
 ]

So here for every 30 batches of designations that I get, I need to update the staff record with that value.

staff.component.ts

for (let i = 0; i <= this.staff.length; i++) {
 this.staffService.getStaffDesignator(//should pass 30 objects).subscribe((designator) => { //Here pass 30 objects
 //update designator logic
 },
 (err) => {

```
})

```

}

staff.service.ts

```
getStaffDesignator(staff)
{

    staff.forEach((staff, index) => {
      if (index === 0) {
        url = url + `?contactId=${staff.id}`;
      }
      else {
        url = url + `&contactId=${staff.id}`
      }
    }) //loop through the objects to get the staff id to pass to the APIcall

    return this.http.get(url, this.options)
      .map((res: Response) => {
        return res.json();
      })  //API call to get designations for staff

}

```