Limit on batch size to 20 individual requests.

Jyoti Marada 1 Reputation point

Our application is consuming Graph URL for image .If application is placing request for more than 20 images in a single call ,the request is failing.

C# Code:

string graphUrl = ConfigurationManager.AppSettings["GraphURL"];
var batchData = JsonConvert.SerializeObject(GetBatchRequest(modifiedUserCount));
var json = new StringContent(batchData, Encoding.UTF8, "application/json");
var watch = new System.Diagnostics.Stopwatch();
HttpResponseMessage result = httpClient.PostAsync(graphUrl, json).Result;
Debug.WriteLine("Timer: " + watch.ElapsedMilliseconds.ToString());
if (result.IsSuccessStatusCode)
//This part of loop is never executed as IsSuccessStatusCode is false.

How can we resolve this issue? Do we need to split our request into multiples ,each with 20 maximum image requests?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,054 questions
0 comments No comments
{count} votes