How to access details of the course and the xblocks within a course

I need to access the entire structure, preferably in a json format, for the current course of the xblock.
Essentially, I want to know which xblocks comes before the current one in the current course.

Can someone please point me to the API that I can use to do this?


You can use the course blocks API through HTTP and get a JSON with the list of blocks:

There are many parameters you can set in the URL to filter and expand the results.

For Python access there’s the XBlock API.