Get Question list greater than 20
I'm running this api call GET /d2l/api/le/(version)/(orgUnitId)/quizzes/(quizId)/questions/ but all I'm getting is only the first 20 questions. How can I pull more than 20 questions? I'm assuming this is a paging issue, but I'm not sure how to get around it.
Comments
-
There should be a variable called "next" that contains a URL for the "next" 20 values. You would have to run your call against that "next" URL until there is no longer a value in the "Next" variable.
-
@Cassidy.D.559 Thank you for that information, I'm still confused on how to use it. Do you have a sample?
EDIT: I got it to work, thank you.
-
Hi Justin,
The API reference says that call returns an object list page. I haven't used that specific call before but I have used some that return an object list page. The .Next element has a link to the next set of results, or null if the end of the list is reached. It is pretty easy to get the next page, just feed the .Next URL into your next get request. For example, I have used it with this call:
GET /d2l/api/le/(version)/(orgUnitId)/classlist/paged/
I've attached a screenshot with some sample code…
I can't include the user data of course, but I did verify the 2nd API call returned a different set of 25 users. Hope this helps!
-
@Joshua.G.520 I got it to work, thank you!
-
I don't see any other endpoint that returns QuestionData so you'll need to use the paging logic like @Cassidy.D.559 referenced.