Reputation: 2727
I'm trying to make a call to Khan Academy API from the browser.
http://www.khanacademy.org/api/v1/playlists/Algebra/videos
For some reason I receive empty list:
[]
What's wrong here, the API call seems fine to me?
Upvotes: 0
Views: 1159
Reputation: 659
Have a look at http://api-explorer.khanacademy.org/api/v1/playlists/topic_slug/videos. This format call is deprecated and according to them you should use http://www.khanacademy.org/api/v1/topic/algebra/videos in stead. They are supposed to give identical results, but the latter should be used for all new applications. Please take note that the topic_slug is case-sensitive and using "Algebra" will give you an error; it must be "algebra".
The reason why you don't get any videos from the call is that there are no videos associated with that topic on that level. It does not give all the videos in the tree of topics below it. At that level there are just sub-topics. So you have to traverse down into the tree until you get the leaf nodes where the exercises and videos are. I don't know of any way around this, but I don't know the API all that well.
Upvotes: 0
Reputation: 4538
A quick Google search for that URL (http://www.khanacademy.org/api/v1/playlists/Algebra/videos) returned this:
Issue #44: No videos being returned Status: Closed
Comments: "The /v1/playlists routes have been deprecated because we are reorganizing our library in a more hierarchical fashion. While the routes still work, the content itself is being moved around.
You should use the /api/v1/topictree route to see how our content is organized and then request more specific topic or video data using the other /topic routes ..." https://github.com/Khan/khan-api/issues/44
Upvotes: 1