Issue with API Request in Open edX: Server Error when Modifying Student Grades

Hello everyone,

I am a newcomer to openedx, and I encountered the following issue while testing the API of the openedx platform using Postman. When I use the POST method to test the API at “/grades/v1-gradebook/{course_id}/bulk-update”, if I send a request without any content in the body, the server returns a 202 Accepted status. However, when I include data in the body, like the following:

{
    "user_id": 4,
    "usage_key": "block-v1:test+test102+test02+type@sequential+block@016bc6ec071944459c02847b60870d5e"
}

the server returns a 500 Internal Server Error. After checking the server logs, I found that the error is caused by “TypeError: string indices must be integers”. I have also tried sending data in other formats or modifying its content, but none of them seem to work.

Can someone please guide me on the correct format and data to be sent to this API to successfully update a student’s grade for a specific subsection? Any help on how to use this API properly would be greatly appreciated. Thank you!

have you tried {LMS_HOST}/api-docs/#/grades/grades_v1_gradebook_bulk-update_create ?

Yes, I have tried accessing the URL /api-docs/#/grades/grades_v1_gradebook_bulk-update_create. However, the page only prompts me to input ‘courseid’, and when I click ‘execute’, it returns the following content:

  • HTTP status code: 202
  • Response body:
  • Response headers:
    • access-control-allow-credentials: true
    • access-control-allow-origin: http://local.overhang.io
    • allow: POST, OPTIONS
    • content-language: zh-cn
    • content-length: 2
    • content-type: application/json
    • date: Tue, 01 Aug 2023 10:11:18 GMT
    • server: Caddy
    • vary: Accept-Language, Origin, Cookie
    • x-frame-options: SAMEORIGIN

This page uses the POST method, but it still doesn’t tell me what kind of data I should send. Do you have any idea about what data I should send or what format the request should follow?

The function is here (start from line 734):

I’m grateful for your assistance. It worked!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.