API Automation

I need to refer one data table from it I need to send record to API, but API payload capacity is 200. if you can suggest, how to generate payload in batches and call API

1 Like

@jast1631

You can make chunks of datatable using dt.AsEnumerable.chunks(200)

Which xna be looped and inside you can make calls with only 200 items

Cheers

1 Like

If u can give some sample screen shot , it will be really helpful. As how to increase the counter , after 200 - first API call should be done and than it should take from row 201

1 Like

You don’t increase the counter. yourDT.AsEnumerable.Chunk(200) doesn’t return the first 200 rows. It returns an IEnumerable(of DataRow[]) which means you loop through IENumerable and then currentItem is an array of DataRow.

2 Likes

If you can share some sample text or image.

I
need to make sure if I have 1000 record in data table I need to call API 5 times with 200 entries at a time.

@jast1631

Use for each activity and in the arguments give dt.AsEnumerable.chunks(200)

Inside the loop currentitem will have datatable with 200 items…

If you try you would get to know and you can make sure loop runs for 5 times with 1000 items 200 each

No counter or anything is needed

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.