VocAPI

VocAPI

Unofficial Promise-based API interface for Vocabulary.com. Uses Vocabulary.com's JSON API enpoints where possible. Falls back on HTML extraction for some features.

Constructor

new VocAPI()

Source:

Methods

addToList(words, listId) → {Object}

Source:
Parameters:
Name Type Description
words Array.<Word> an array of words to add to the list
listId number id of the list
Returns:
Type:
Object
response object

addToListName(words, listName) → {Object}

Add a given list to an existing list, given by name. The first (most recent) list with that name will be used. Convenience method that combines getListName and addToList.
Source:
Parameters:
Name Type Description
words Array.<Word> an array of words to add to the list
listName number name of the list
Returns:
Type:
Object
statusObject 0 is ok

addToNewList(words, listName, description, shared)

Source:
Parameters:
Name Type Description
words an array of words to add to the new list
listName name of the new list
description description of the list
shared boolean that shows whether list should be shared or not

autoComplete(searchTerm) → {Array.<Meaning>}

Gives word suggestions for a search term. All suggestions are valid vocabulary.com words. The searchTerm can be a partial word, or slightly misspelled.
Source:
Parameters:
Name Type Description
searchTerm * searchterm
Returns:
Type:
Array.<Meaning>
a list of possible word meanings (from different words)

checkLogin()

Checks the login status. Queries the account page. If a redirect to the login page occured, this promise fails. Otherwise it succeeds.
Source:

correctWord(word)

Attempts to correct the word with the nearest available word in Vocabulary.com. Rejects if no word was found.
Source:
Parameters:
Name Type Description
word String the word to correct

correctWords(words)

Bulk-correct a list of word objects.
Source:
Parameters:
Name Type Description
words Array.<Word> a list of word objects to be corrected

getDefinition(word) → {Definition}

Gets definition of a word.
Source:
Parameters:
Name Type Description
word String the word to get a definition for
Returns:
Type:
Definition
definition in the format. Proper return format documentation TODO, check the code

getList(listId) → {VocList}

Gets a list of words
Source:
Parameters:
Name Type Description
listId string the ID of the list to get
Returns:
Type:
VocList
vocabulary.com word list object with a key "words" for the objects and other metadata

getListByName(name) → {VocList}

Source:
Parameters:
Name Type Description
name String name of the list
Returns:
Type:
VocList
the requested list

getListName(id)

Source:
Parameters:
Name Type Description
id *

getLists() → {Array.<VocListDescription>}

Returns a list of the lists of the logged in user.
Source:
Returns:
Type:
Array.<VocListDescription>
a list of word lists. Proper return format documentation TODO, try it out & see what happens!

getMeanings(word) → {Array.<Meaning>}

Gives a list of learnable meanings (definitions) of the specific word
Source:
Parameters:
Name Type Description
word String the word for which to retrieve meanings.
Returns:
Type:
Array.<Meaning>
a list of learnable meanings of the specific word

getProgress(word) → {Object}

Gets the learning progress of a word
Source:
Parameters:
Name Type Description
word String the word for which to retrieve progress
Returns:
Type:
Object
progress object. Proper return format documentation TODO, try it out & see what happens!

login(username, password)

Logs the user in & sets internal cookie auth so that further methods can access account-specific information.
Source:
Parameters:
Name Type Description
username String Username for the vocabulary.com account.
password String Password for the vocabulary.com account.

setPriority(word, priority) → {Promise}

Sets the priority for learning a word
Source:
Parameters:
Name Type Description
word *
priority * afaik: -1 for low priority (or auto?), 0 high priority
Returns:
Type:
Promise

startLearning(wordToLearn)

Source:
Parameters:
Name Type Description
wordToLearn String word

startLearningList(listId)

Source:
Parameters:
Name Type Description
listId String list to start learning