Identify xblocks used on specific pages

I am trying to determine whether it is possible to identify the individual xblocks used on specific unit pages. The use cases are things like determining whether a specific xblock has actually been used before pushing updates of that xblock, identifying which xblocks exist on a unit page seen by a student, etc.

So far, my technical team has not found a way to do this. I’m hoping someone here has solved similar problems.

Hi @mikeh1239

The course blocks API should do what you want.

For example, on devstack you can use http://localhost:18000/api/courses/v1/blocks/?course_id=course-v1:edX%2BDemoX%2BDemo_Course&username=staff&depth=all to get all the blocks in a course. (To use this API on another server, you’ll need to change the domain name, course ID, and username).

The entries will look like this:


What you want is "type": "html" - this indicates the type of each XBlock, and the entire response will let you quickly scan to check the types of all XBlocks in the course.

If you only want to check the blocks used on a single unit, get the unit’s ID (which should include vertical) then use this similar API:

The response format is the same, but it will only return a single unit.

Thank you for your generosity and expertise!

1 Like