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?

Thanks

You can use the course blocks API through HTTP and get a JSON with the list of blocks:
https://LMS/api/courses/v1/blocks/?course_id=course-v1%3AedX%2BDemoX%2BDemo_Course&all_blocks=true

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

For Python access there’s the XBlock API.