Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Dcoument tags argument to /api/v1/exercises better #116

Open
ThomasKranitsas opened this issue Oct 21, 2016 · 9 comments
Open

Dcoument tags argument to /api/v1/exercises better #116

ThomasKranitsas opened this issue Oct 21, 2016 · 9 comments

Comments

@ThomasKranitsas
Copy link

When I make a call to /api/v1/exercises without pass any tag in the query the endpoint works fine but if I pass any tag e.g.: /api/v1/exercises?tags=math I get an empty array as result ([]).

No matter what the tag or how many tags I'll use, the result is always an empty array.

I noticed that the tag attribute in all objects returned from the /api/v1/exercises is an empty array, maybe this is why the api returns an empty array when I pass any query.

@ThomasKranitsas
Copy link
Author

FYI I use POSTMAN to make calls because the API explorer gives me 500 INTERVAL ERROR as mentioned in #115

@rootelement
Copy link

Anything on this issue? We're unable to use this API without this feature.

@benjaminjkraft
Copy link
Contributor

It seems like this field was never working correctly for exercises in our newer exercise framework, and the only change is that we've migrated all exercises over. I'll file an internal bug, but I'm not sure how soon we'll get to it. You may need to find a workaround, such as by using /api/v1/assessment_items/tags, and using the returned tag ID/name pairs to do the filtering on the client.

@benjaminjkraft
Copy link
Contributor

Ah, it looks like there is in fact a better way. If you get /api/v1/assessment_items/tags, and find your desired tag in there, you can use the "id" field from that response as a tag to filter on. I'll leave this issue open, to improve our documentation to explain this.

@benjaminjkraft benjaminjkraft changed the title Always get empty array as result from /api/v1/exercises when using tags Dcoument tags argument to /api/v1/exercises better Oct 27, 2016
@rootelement
Copy link

I have a couple clarifying questions...

  1. The /api/v1/assessment_items/tags is an endpoint not documented in your api explorer correct?
  2. The IDs that come back from those tags look like this: ag5zfmtoYW4tYWNhZGVteXIxCxIRQXNzZXNzbWVudEl0ZW1UYWciATAMCxIRQXNzZXNzbWVudEl0ZW1UYWcYmbU_DA
  3. You're recommending we query the /exercises endpoint, get back all exercises (24mb Compressed Response) and front-end string match on those IDs?

I don't think that's at all viable... This is for a project for GE Foundation and College for Every Student who wanted to surface Khan courses to the students in the STEM program. Is there some way we can connect outside of GitHub Issues to see if we can move this forward?

The site is http://brilliantcareerlab.org

cc: @ThomasKranitsas

@benjaminjkraft
Copy link
Contributor

  1. Correct. I've made an internal issue to document it.
  2. Correct.
  3. Sorry, to be clearer -- that was my first suggestion, but then I realized you can also pass those to /api/v1/exercises?tags=ag5z..., and it should do the same filtering.

I'll follow up internally on Monday and see if there's a good person with whom to put you in contact.

@benjaminjkraft
Copy link
Contributor

Also, @rootelement, I'm [email protected] -- if you send me an email I can put you in contact with appropriate folks on our team.

@krisives
Copy link

krisives commented Jan 19, 2017

@benjaminjkraft Thank you for the details about this situation. We are running into the same issue as we have a student that has a very large history of exercises which when we use the API throws a 500 because the result is too big. I have read your suggestion for filtering on tags, but this is not viable for us since we need to check all exercise activity in the last 24 hours in bulk.

The first thing I did was load the khanacademy.org website itself to see how it does this. I then noticed it does not use the v1 API but instead uses an "internal" API which has different tokens and keys from what I can tell. This internal API being used is called "progress" and it passes date stamps as "dt_start" allowing it to filter. I tried passing these to the v1 API and had no luck. From my experience other than tag there is no way to filter the result set coming back from the v1 exercises endpoint. If we had any ability to filter based on time or limit or pagination we could solve all our problems.

I noticed others discussing POSTMAN a third party commercial service. I am not familiar with this, but I wanted to know if Khan Academy API works any differently through this service. Does Khan affiliate with or provide different access via POSTMAN that would solve this, or are they just a third party that does the same OAuth API requests on our behalf? I understand if you are not familiar with POSTMAN but thought I would ask anyway since we need a solution.

@benjaminjkraft
Copy link
Contributor

@krisives that sounds like a different issue -- the problem reported here is about the tags argument not working as documented. If you could file a separate issue to discuss, that would help us investigate.

You are welcome to use our internal APIs as well as documented ones, but keep in mind that we don't generally provide support for them and they can change at any time. If you mention the specific endpoint you're using, we may be able to post at least a little unofficial documentation.

We're not affiliated with POSTMAN, so they would just be a third party that would do the same requests on your behalf.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants