5

How can I get the articles of a topic through the Khan Academy API? I can see how it works with exercises and videos, but what about articles?

For example the query

http://www.khanacademy.org/api/v1/topic/beginners-art-history

returns the contents of the page

https://www.khanacademy.org/humanities/art-history-basics/beginners-art-history/

How can I get the content of the article "A brief history of Western culture" inside it?

sofia
  • 440
  • 7
  • 20
  • 1
    Searching for this as well. The trouble is that articles does not seem to be even in the full topictree. The articles are kind of new and they probably did not upgrade the API for a while – Daniel Hollas Nov 29 '16 at 12:21

1 Answers1

3

The correct API call for an article is:

http://www.khanacademy.org/api/v1/articles/%s

In the JSON returned by your topic API call, use "id" in the "child_data" array for the %s above (the articles have the "kind" entries with value "article".)

(You can also use "id" in the "child_data" array to look for the corresponding "internal_id" in the "children" array to get some basic information about the article, e.g. title and description.)

So for your topic call,

http://www.khanacademy.org/api/v1/topic/beginners-art-history

you get the id "1314267931" and then call

http://www.khanacademy.org/api/v1/articles/1314267931

Jannie Gerber
  • 659
  • 1
  • 7
  • 15
  • Cool, thanks! But just another question. Where is the documentation for all this? Because at https://api-explorer.khanacademy.org the article calls do not appear – sofia Dec 05 '16 at 09:39
  • 1
    @sofia, Unfortunately I don't remember where I saw it. It could have been here on this site or maybe even when I looked at some source code somewhere, but I can't seem to find it again, sorry. (I REALLY wish they would document their API properly! There is also a v2 API but even less info on it...) – Jannie Gerber Dec 06 '16 at 11:45