Looks like the Great Firewall or something like it is preventing you from completely loading www.skritter.com because it is hosted on Google App Engine, which is periodically blocked. Try instead our mirror:

legacy.skritter.cn

This might also be caused by an internet filter, such as SafeEyes. If you have such a filter installed, try adding appspot.com to the list of allowed domains.

Item Endpoint

The Item endpoint gives you complete access to what words a user is studying, how well they know it, and some key info about the history of an item's study. Use this endpoint if you would like to know:

  • What words are being studied.
  • How well any given word/part is known.
  • What was studied last, or will be studied next.
GET http://beta.skritter.com/api/v0/items

Request

  • sort
    response sort order.
    "next": what will be studied next (based on current settings)
    "last": what was studied (regardless of current settings)
    "changed": when properties were changed for any reason
    (default "last")
  • lang
    The language of the Items you want to fetch.
    (default: user setting)
  • parts
    comma-separated list of parts to include in the response. Only works for 'next' sort.
    (default: user setting)
  • styles
    comma-separated list of styles to include in the response. Only works for 'next' sort.
    (default: user setting) (Chinese only)
  • created
    returns only Items created before the given timestamp.
  • limit
    maximum number of Items to fetch. Note that for 'last' and 'changed' sorts first fetch this number of Items, then filters out based on styles and parts, so you may not receive this number of Items in the response, even though there are more.
    (default: 100) (max: 100)
  • cursor
    string used for pagination
  • offset
    timestamp that filters the result based on sort type. For example, if sort is "next", only returns Items due after the given offset.
  • ids
    pipe-separated list of Items to fetch. Overrides any query based properties used.
  • vocab_ids
    pipe-separated list of Vocabs to fetch items for. Overrides any query based properties used.
  • vocab_list
    id of a VocabList to fetch items for. Only works for "next" queries.
  • include_contained
    whether to return child Item objects of those returned. If include_vocabs is included, also adds contained Vocab objects in the response.
    (default: false)
  • fields
    comma-separated list of Item properties to return.
    (default: all)
  • include_vocabs
    whether to return Vocab objects related to the Items returned.
    (default: false)
  • vocab_fields
    comma-separated list of Vocab properties to return.
    (default: all)
  • definition_langs
    comma-separated list of languages the Vocab definitions should include.
    (default: English and user setting)
  • include_heisigs
    adds Heisig definitions to the Vocabs.
  • include_sentences
    returns a list of sentences chosen by the user to learn with the returned Vocabs
  • sentence_fields
    comma-separated list of Vocab properties to return for the sentences.
  • include_top_mnemonics
    adds the highest rated Mnemonics to the returned Vocabs
  • include_decomps
    returns a list of Decomps for the returned Vocabs
  • decomp_fields
    comma-separated list of Decomps for the returned Vocabs
  • ids_only
    returns only the ids of the Items, and is relatively fast. Cannot do sort 'next' or any of the 'include' parameters. Limit can go as high as 1000.

Response

  • Items
    list of Items. If by id, non existent Items will have null in their place. Includes Items for the child Vocabs.
  • Vocabs
    list of related Vocabs.
  • cursor
    string to pass back in future requests for pagination. If not included, there are no more. If included, there probably are more.
  • vocabItemMap
    object of Vocab ids to Item ids, to simplify relating the two. Only returned if vocab_ids is used.
POST http://beta.skritter.com/api/v0/items

Creates new Items.

Input

A list of Items objects. Used to add or update Items for a given Vocab in a given VocabList. vocabIds, vocabListIds, and sectionIds must each be a list with exactly one id. part and lang properties must also be set. This endpoint is intended to be used as a way to manually add items, if the client has enough information to choose for itself, or would like to have more control over the order of adding.

Parameters

  • fields
    comma-separated list of Item properties to return.

Response

  • Items
    All Items which are created or changed.
  • conflictingResource If adding the given Item conflicts with the state of either the User, VocabList, VocabListSection, or Vocab, this endpoint returns a 409 and this object which contains two properties: 'type' (the type of resource) and 'resource' (the resource itself, which probably needs to be updated by the client and whose properties affect what Items can be added).
POST http://beta.skritter.com/api/v0/items/add

Note that this is the only request which ever returns 402 (payment required) errors. Make sure those are handled.

As opposed to POST /items above, this endpoint chooses the next Item to add automatically.

Request

  • lang
    The language of the Vocabs you want to add.
    (default: user setting)
  • limit
    maximum number of Vocabs to add.
    (default: 1) (max: 1 if direct, 100 if part of a batch)
  • offset
    offset for which list to start adding from. When there are multiple lists available or provided to add from, Vocabs are added round-robin style. This offset number is modded with the length of the list which provides the list to start with. So if there are 5 lists and an offset of 13 is given, the fourth list is added from first. If you don't include an ever-increasing offset value, the first list will always be added from.
    (default: 0)
  • lists pipe-separated list of VocabLists to add from. If not provided, the ten most recently changed lists will be added.
  • fields
    comma-separated list of Item properties to return.
    (default: all)
  • vocab_list_fields
    comma-separated list of VocabList properties to return.
    (default: all)

Response

  • Items
    list of Items added.
  • VocabLists
    list of VocabLists added from.
  • numVocabsAdded
    number of Vocabs added. Useful for adding to your previous 'offset' value for next time, since it will correlate with how many lists were stepped through.
POST http://beta.skritter.com/api/v0/items/addmissing

If a word Item exists in an account but respective component Items do not, use this handler to fill in the gaps and get the new data.

Request

  • vocabId
    The id of the Vocab which is missing component Items
    (required)
  • fields
    comma-separated list of Item properties to return.
    (default: all)
  • vocab_fields
    comma-separated list of Vocab properties to return.
    (default: all)
  • include_heisigs
    adds Heisig definitions to the Vocabs.
  • include_sentences
    returns a list of sentences chosen by the user to learn with the returned Vocabs
  • sentence_fields
    comma-separated list of Vocab properties to return for the sentences.
  • include_top_mnemonics
    adds the highest rated Mnemonics to the returned Vocabs
  • include_decomps
    returns a list of Decomps for the returned Vocabs
  • decomp_fields
    comma-separated list of Decomps for the returned Vocabs

Response

  • Items
    list of Items added.
  • Vocabs
    list of component Vocabs for the given vocabId
  • Sentences
    list of sentence Vocabs for the returned Vocabs list.
  • Decomps
    list of Decomps for the returned Vocabs list.
GET http://beta.skritter.com/api/v0/items/due

Returns a summary of how many Items are due, broken down by part and style.

Request

  • lang
    Which language to fetch stats for.
    (default: user setting)
  • parts
    comma-separated list of parts to report on
    (default: user setting)
  • styles
    comma-separated list of styles to report on (can include 'none' for items which are not being studied, but would be due if they were)
    (default: user setting)
  • styles
    comma-separated list of styles to report on (can include 'none' for items which are not being studied, but would be due if they were)
    (default: user setting)

Response

  • Items
    list of Items added.
  • Vocabs
    list of component Vocabs for the given vocabId
  • Sentences
    list of sentence Vocabs for the returned Vocabs list.
  • Decomps
    list of Decomps for the returned Vocabs list.

Examples

Goal: Fetch all writing and tone Items the user has ever created.

Solution: make repeated calls, passing back the cursor string for each subsequent call, leaving all other parameters constant.


    # unlike 'next' or 'last', 'changed' includes all Items the user has
    # regardless of current state
    params = {
        'sort': 'changed',
        'parts': 'rune,tone',
        'bearer_token': token,
        'gzip': False
    }

    items = [] # where we'll be storing the results

    while True:
        # make repeated calls to fetch everything.
        response = client.get('http://beta.skritter.com/api/v0/items', params)
        response = json.loads(response.content)

        # once there's no cursor, we can stop
        if not 'cursor' in response:
            break

        # gather up the results
        items += response['Items']
        print 'fetched %d items' % len(items)

        # for the next iteration, provide the cursor from the last response
        params['cursor'] = response['cursor']

    return items

    

Note: this can be done much faster through Parallel GET queries.