# Instructor data downloads for student responses via an API

**URL:** <https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683>\
**Category:** Development\
**Tags:** api, how-to\
**Created:** [April 6, 2021, 4:44am UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683 "2021-04-06T04:44:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![james\_imsimbi](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@james\_imsimbi](https://discuss.openedx.org/u/james_imsimbi)\
**Post date:** [April 6, 2021, 4:44am UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/1 "2021-04-06T04:44:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![braden](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/braden/32/46_2.png) [@braden](https://discuss.openedx.org/u/braden)\
**Post date:** [April 7, 2021, 8:51pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/2 "2021-04-07T20:51:08Z")

</div>

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](https://github.com/edx/edx-platform/pull/24873)

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](https://github.com/edx/edx-platform/pull/19635)

---

<div class="post-metadata">

**Author:** ![james\_imsimbi](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@james\_imsimbi](https://discuss.openedx.org/u/james_imsimbi)\
**Post date:** [April 7, 2021, 10:26pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/3 "2021-04-07T22:26:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![braden](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/braden/32/46_2.png) [@braden](https://discuss.openedx.org/u/braden)\
**Post date:** [April 8, 2021, 6:18pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/4 "2021-04-08T18:18:59Z")

</div>

@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](https://github.com/edx/edx-platform/pull/19635#issuecomment-468310130).

---

<div class="post-metadata">

**Author:** ![james\_imsimbi](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@james\_imsimbi](https://discuss.openedx.org/u/james_imsimbi)\
**Post date:** [April 9, 2021, 10:43pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/5 "2021-04-09T22:43:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![braden](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/braden/32/46_2.png) [@braden](https://discuss.openedx.org/u/braden)\
**Post date:** [April 9, 2021, 11:46pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/6 "2021-04-09T23:46:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xitij2000](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/xitij2000/32/141_2.png) [@xitij2000](https://discuss.openedx.org/u/xitij2000)\
**Post date:** [April 13, 2021, 11:54am UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/7 "2021-04-13T11:54:40Z")

</div>

@james_imsimbi @braden I’ve created a [fresh new PR](https://github.com/edx/edx-platform/pull/27313) that leaves the original endpoints untouched and creates new ones for MFEs or other API uses.

---

<div class="post-metadata">

**Author:** ![james\_imsimbi](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@james\_imsimbi](https://discuss.openedx.org/u/james_imsimbi)\
**Post date:** [May 17, 2021, 3:16am UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/8 "2021-05-17T03:16:49Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![xitij2000](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/xitij2000/32/141_2.png) [@xitij2000](https://discuss.openedx.org/u/xitij2000)\
**Post date:** [May 17, 2021, 9:16pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/9 "2021-05-17T21:16:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![james\_imsimbi](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@james\_imsimbi](https://discuss.openedx.org/u/james_imsimbi)\
**Post date:** [June 2, 2021, 3:57am UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/10 "2021-06-02T03:57:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![xitij2000](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/xitij2000/32/141_2.png) [@xitij2000](https://discuss.openedx.org/u/xitij2000)\
**Post date:** [June 3, 2021, 12:39pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/11 "2021-06-03T12:39:35Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![arbrandes](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/arbrandes/32/158_2.png) [@arbrandes](https://discuss.openedx.org/u/arbrandes)\
**Post date:** [June 3, 2021, 5:06pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/12 "2021-06-03T17:06:17Z")

</div>

> [@james\_imsimbi](#):
>
> Do you know when this feature will get added to lilac?

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

---

<div class="post-metadata">

**Author:** ![ABC](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/abc/32/4946_2.png) [@ABC](https://discuss.openedx.org/u/ABC)\
**Post date:** [March 21, 2023, 4:53pm UTC](https://discuss.openedx.org/t/instructor-data-downloads-for-student-responses-via-an-api/4683/13 "2023-03-21T16:53:00Z")

</div>

> [@braden](#):
>
> You should be able to run `./manage.py lms help` to get a list of available commands though.

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/](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](http://localhost:18000/api/instructor/v1/tasks/$COURSE_ID) -H ‘Authorization: Bearer devstackstaff’

```auto

Thank you.
```
