You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何调用Khan Academy API获取指定习题任务的具体题目内容

How to Fetch Single Task Content from Khan Academy Exercise API

Hey there! I’ve worked with the Khan Academy API a few times, so let me walk you through exactly how to get the full question content for a single task:

Step 1: Grab the Unique Task ID

From the items array in your initial API response, each entry has a distinct id field (like xe2f9023f8445e171 in your example). This ID is your key to targeting that specific task.

Step 2: Build the Single Task API Endpoint

Khan Academy’s API has a dedicated path for individual exercise tasks. You’ll extend your original exercise API URL by adding /tasks/{task_id} at the end.

For your example exercise (negative_number_word_problems) and task ID (xe2f9023f8445e171), the full request URL would be:

http://www.khanacademy.org/api/v1/exercises/negative_number_word_problems/tasks/xe2f9023f8445e171

Step 3: Make the Request to Get Full Task Details

When you call this endpoint, it will return all the specific content for that task, including:

  • The actual question text (stored in the content field, formatted for Perseus—Khan Academy’s exercise rendering framework)
  • Answer options (if it’s a multiple-choice task)
  • Hints, solution walkthroughs, and other task-specific metadata

To test this quickly, you can use a command like curl in your terminal:

curl http://www.khanacademy.org/api/v1/exercises/negative_number_word_problems/tasks/xe2f9023f8445e171

Quick Note on Perseus Formatting

The content field uses Perseus’s structured format to handle math notation and interactive elements. If you need to render this content in an app, you’ll want to use the Perseus library to parse and display it properly—but the raw API response already contains all the core question details you’re looking for.

内容的提问来源于stack exchange,提问作者Bodlund

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:00:13