Open edX API: gradebook score per problem

We need to get data about the user’s score per problem. I checked for endpoints that exist today and have not found a way to do this.

I want to discuss:

  • The /api/grades/v1/gradebook/course-v1%3AHIT%2BProgAllVis%2B2019_1/ endpoint returns it per section?
  • How it’s possible to get a user’s score per problem?

Hi @Vladimir_Susloparov !

I dug through the available APIs (on your devstack, that’s http://localhost:18000/api-doc), and found one that will return the score for a specific problem: instructor_v1_reports_generate_problem_responses_create.

However, it’s not very convenient… it queues an instructor task to generate a CSV file that contains scores (and other problem data) for all the users in your course, and for a given set of problems. But depending on your use case, this might be helpful?

It can be invoked from the LMS Instructor dashboard for a course, under Data Downloads > Reports > “Create a report of problem responses”, or by using the following API:

Request URL: http://localhost:18000/api/instructor/v1/reports/course-v1%3AedX%2BDemoX%2BDemo_Course/generate/problem_responses
Example usage:

curl -X POST "http://localhost:18000/api/instructor/v1/reports/course-v1%3AedX%2BDemoX%2BDemo_Course/generate/problem_responses" -H  "accept: application/json" -H  "Content-Type: application/json" -H  "X-CSRFToken: QIk6ytJq8VdXgxsyaV6vKe4YgnZZdqA9cHa0yf4nI8YJ4qBcYdXAleRUIav4yrIs" -d "{  \"problem_locations\": [    \"block-v1:edX+DemoX+Demo_Course+type@problem+block@9cee77a606ea4c1aa5440e0ea5d0f618\"  ],  \"problem_types_filter\": []}"
1 Like

Hello @jill. I think this might be an answer to my question that no one answered here. However, how can I create that X-CSRFToken in order to try this out? And does this have to be done from on the system where tutor is running, or can another instructor do it if they put in the site’s full URL instead of localhost, and they have the right authentication token?

Hi @ABC :slight_smile:

However, how can I create that X-CSRFToken in order to try this out?

There’s an API for fetching CSRF tokens:

And does this have to be done from on the system where tutor is running, or can another instructor do it if they put in the site’s full URL instead of localhost, and they have the right authentication token?

Yes, users need to be authenticated to the site in order to use the API.
But you should be able to hit these endpoints from the site’s full URL instead of localhost.

Let us know if this works for you?