sofia
sofia

Reputation: 502

Getting articles through the Khan Academy API

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?

Upvotes: 5

Views: 1009

Answers (1)

Jannie Gerber
Jannie Gerber

Reputation: 659

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

Upvotes: 3

Related Questions