Bodlund
Bodlund

Reputation: 81

Way to correct access specific exercise Khan Academy

Hi I am trying to get a certain exercise from KhanAcademy by first doing the request: http://www.khanacademy.org/api/v1/exercises/negative_number_word_problems

This gives me all the tasks for the exercise e.g

  "items": [
    {
      "sha": "652fd293d4fa8ff01774397934261ec2c100e21c",
      "live": true,
      "id": "xe2f9023f8445e171",
      "perseus_api_major_version": null,
      "requires_screen_or_mouse": false
    },

How can I call just that question or task to present the actual question ?

Upvotes: 0

Views: 84

Answers (1)

Jett
Jett

Reputation: 17

EDIT

Actually, I came across this Python wrapper for the API, which made use of an assessment item API endpoint. In your case it would be:

https://www.khanacademy.org/api/v1/assessment_items/xe2f9023f8445e171

Outdated answer

I did lots of poking around but could not find a way to get data about an assessment item with the v1 API. I'm pretty sure there was never an endpoint for this.

There is, however, an endpoint for this in Khan Academy's internal API: https://www.khanacademy.org/api/internal/user/exercises/<exercise-id>/items/<item-id>/assessment_item

So for example, to get information about the question you included: https://www.khanacademy.org/api/internal/user/exercises/261977487/items/xe2f9023f8445e171/assessment_item

The actual question is inside the itemData key, which is JSON you can parse to access more info.

Hope this helps! If it did, please vote up and accept this answer.

Upvotes: 0

Related Questions