Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
Found this content helpful? Log in or sign up to leave a like!
In the Discussion Topics - Canvas LMS REST API Documentation, there is a section as follows:
List topic entriesDiscussionTopicsApiController#entries
url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries
url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries
Retrieve the (paginated) top-level entries in a discussion topic.
May require (depending on the topic) that the user has posted in the topic. If it is required, and the user has not posted, will respond with a 403 Forbidden status and the body 'require_initial_post'.
Will include the 10 most recent replies, if any, for each entry returned.
If the topic is a root topic with children corresponding to groups of a group assignment, entries from those subtopics for which the user belongs to the corresponding group will be returned.
Ordering of returned entries is newest-first by posting timestamp (reply activity is ignored).
My question is if there are more than 10 replies, how could they be retrieved.
Thanks,
Paul
You need to use Pagination. There is a document in the API instructions that explains Pagination and what needs done.
It does not really provide a technical solution of how to do it, leaving that up to each user and the specifics vary from programming language to language. There is a thread in the Canvas Developers group called Handling Pagination , where several users have shared their approaches.
In a pinch, you can add per_page=100 to the end of the query string as a parameter. The 100 is the maximum I've seen anything accept, but it may be less. Even then, eventually you will run past the limit and have to deal with pagination.
You may also want to check out Canvas APIs: Getting started, the practical ins and outs, gotchas, tips, and tricks. @stuart_ryan has done a wonderful job with an introduction to API and things to watch out for.
Wouldn't pagination apply to the list of topic entries, not the up to 10 most recent replies that are included with the entry?
I think the 10 is just a convenience thing, if there are more it is indicated with has_more_replies.
You can call the "List entry replies" ( Discussion Topics - Canvas LMS REST API Documentation) to get all of the replies for the entry.
Good catch, pklove. I probably shouldn't try to answer questions after getting up early, loading the car to leave Instructurecon, going to an unconference, and then driving all day. I saw the 10 and assumed it was pagination-related.
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign InTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign In