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.

Tagged:

Comments

  • Cassidy.D.559
    Cassidy.D.559 Posts: 1 🌱

    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.

  • Justin.B.253
    Justin.B.253 Posts: 20 🌱
    edited September 3

    @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.

  • Joshua.G.520
    Joshua.G.520 Posts: 3 🌱

    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!

  • Justin.B.253
    Justin.B.253 Posts: 20 🌱

    @Joshua.G.520 I got it to work, thank you!

  • Adam.S.1983
    Adam.S.1983 Posts: 2 🌱
    I don't see any other endpoint that returns QuestionData so you'll need to use the paging logic like @Cassidy.D.559 referenced.