AnsweredAssumed Answered

Not able to get all users using GET method - C#

Question asked by Jerry A Natarajan on Oct 18, 2015
Latest reply on Nov 11, 2015 by Stefanie Sanders

hi all,

 

I have been trying to get all users(~3k users) from Canvas and I am not able to get beyond 100 records. I tried per_page = 1000 etc, but no effect. the Code snippet I use is as below. Can someone let me know if there is a way to get all records. Also I appreciate a sample C# code as a guidance. Thanks in advance.

 

using (HttpResponseMessage
response =
await client.GetAsync("api/v1/accounts/1/users.json?access_token=MYTOKEN&per_page=10000"))

{

if
(response.IsSuccessStatusCode)

     
       {

             Console.WriteLine("Success");

             List<User>
userStudent =
null;

             var content = await
response.Content.ReadAsStringAsync();

userStudent = JsonConvert.DeserializeObject<List<User>>(content);

             Console.WriteLine(userStudent.Count());

}

}

Outcomes