![]() ![]() Pass in the page_after_id parameter with with the id you want to look after. The previous page of results can be requested by passing in the page_before_id parameter, with the value being the id you want to look before. Pro tip: the first page has no previous page, and the last page has no next page. ![]() Maximum number of resources delivered for this collection. If there are no results at all or no previous page to go to, the value is null. If there are no more results, the value is null. We use the id of a resource as the cursor.Ĭollections have the following nested within a pages attribute: Attribute When there are more resources to return than the per-page limit, we use a cursor-based pagination scheme to move through the pages of results. That is a count of all resources available within the specified scope, not limited to pagination. Those same responses have a total_count attribute, too. Some endpoints may return a different size - reviews and subjects have a maximum size of 1,000.Īny collection response has the per-page count in the pages.per_page attribute. Pagination Collection Sizeīy default, the maximum number of resources returned for collection endpoints is 500. We follow the Javascript standard for date formatting, returning them in ISO 8601 format, rounded to the microsecond. We stick to the common JSON data types in our responses: strings, integers, booleans, arrays, and objects. As mentioned before, there are two object types that return information on many different resources: For resources, these are the attributes that are specific to that particular instance and kind of resource.Įvery successful API response contains an object attribute that tells you which kind of thing you're getting. For a resource, then this is the last time that particular resource was updated.įor collections, this is going to be the resources returned by the specified scope. If no resources were returned for the specified scope, then this will be null. Resources have a single URL and don't need to be filtered, so the URL will be the same in both resource and collection responses.įor collections, this is the timestamp of the most recently updated resource in the specified scope and is not limited by pagination. For collections, that will contain all the filters and options you've passed to the API. See the object types section below for all the kinds. Reports summarize disparate or novel information into a single place, and don't follow the same structure as collections.Īll of the responses have a few shared, high-level attributes: object, url, data_updated_at, and data. There's a third type of structure that's less common: a report. Collections contain summary data about a bunch of resources, and also include each of the resources. Singular resource endpoints deliver information about a single entity, such as an assignment or subject. There are two main structures we return: resources and collections. We return JSON from all the API endpoints, even when an error occurs. Any requests made over HTTP or without authentication headers will fail. The token has to be included with every request, and should be delivered in a HTTP header that looks like:Īlso note that all requests must be made over HTTPS. You can obtain and manage your v2 token in Settings / API Tokens on WaniKani. WaniKani uses your secret API token to authenticate requests to the API. Var apiToken = ' ' var apiEndpointPath = ' ' var requestHeaders = new Headers () fetch ( apiEndpoint ). Finally, details for all of the available resources and endpoints are under Resources.įeel free to reach out via email or through the community if you have any questions, comments, or requests about the API. We make a few suggestions on how to optimize your usage of the API in Best Practices and clarify a few obscure topics under Additional Information. We've got information on general usage, like authentication and error codes, in Getting Started. These should open up the API to any client that supports these features and data structures. We respond to all requests with JSON, making it easy to parse those responses into native objects in a variety of languages. We've turned on cross-origin resource sharing to allow for secure client-side access. We support that structure with standard HTTP features: HTTP verbs for all our endpoints to indicate different actions, HTTP authentication headers, and HTTP response codes to indicate both success and various errors. This version is built around a RESTful structure, with consistent, resource-oriented URLs. Welcome to "WaniKani: The API!" You can use our API to access progress data for a user's account and a ton of general reference data for the subjects within WaniKani. Get a Specific Spaced Repetition System.Spaced Repetition System Data Structure. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |