Instructor data downloads for student responses via an API

I would like to download the student problem responses for a course via an API.

I don’t see a ReST API to do this directly - is that correct?

Is there an API to initiate a download task (as would happen when a data download is requested in the Instructor tab of the course front end, using “Create a report of problem responses”)? Getting the student responses as a data download would be fine for my use case.

I have tried to use the endpoints that the front end uses, for example: https://example.com/courses/course-v1:edX+DemoX+Demo_Course/instructor/api/list_instructor_tasks, but the endpoint requires a CSRF cookie which implies that they are not intended to be used outside the front end?

1 Like

My team has a pull request open to implement this exact functionality. We’d love if you could test it and provide feedback: Add OAuth2 support for problem response reports endpoints by pcockwell · Pull Request #24873 · edx/edx-platform · GitHub

More details are on the earlier version, which unfortunately was reverted as it may have had a bug: https://github.com/edx/edx-platform/pull/19635

Thanks @braden! What is holding up the PR? I t looks like some of the pipeline checks are failing, but I am not able to see the details. If I can, I would be happy to help to get this merged.

@xitij2000 is planning to rebase the PR very soon, and the failing tests should be gone once he does that. I think the main cause of delay is that we don’t yet understand if or how this PR may have caused the error that was seen last time it was deployed.

@braden is there a way to run these reports using manage.py or cimilar CLI utilities?

I’m not sure. You should be able to run ./manage.py lms help to get a list of available commands though.

@james_imsimbi @braden I’ve created a fresh new PR that leaves the original endpoints untouched and creates new ones for MFEs or other API uses.

@xitij2000 thanks for this and I see the PR was merged. I am considering patching this PR onto the Koa release (open-release/koa.2) - as far as you know are there any other changes that it depends on that might cause this not to work?

It’s hard to say honestly. There are a lot of changes going on especially with removing six etc that might make it hard to resolve the diff. The work is done near lilac and koa is pretty old now, so chances are it won’t apply cleanly.

That said it’s definitely worth a try. It isn’t using any kind of external library code that would be affected between releases.

Thanks @xitij2000 ! I will upgrade to lilac - and it sounds like the PR will be more likely to work with lilac. Do you know when this feature will get added to lilac?

@james_imsimbi I’m afraid I don’t know. I don’t know the cuttoff there. It might just be part of Maple. Although it should be a pretty simple backport to Lilac if it doesn’t make it.

I’m afraid it didn’t make the cut for Lilac by about a month. But:

  • It will be much easier to backport the change to Lilac than to Koa
  • It will definitely be included in Maple

I ran tutor local run lms ./manage.py lms help and I don’t see any obvious commands to get grade reports through manage.py.

Is there any guide on how to use the change that was added in that PR to do a grade report query in Nutmeg? Unfortunately I couldn’t understand what some of the comments in the PR like “Create token at http://localhost:18000/admin/oauth2_provider/accesstoken/29/” meant (I get that it’s an authentication token, I’m just not sure how it is created), or what I would change in " ```
curl http://localhost:18000/api/instructor/v1/tasks/$COURSE_ID -H ‘Authorization: Bearer devstackstaff’


Thank you.