Endpoints
Endpoints can be accessed from properties whose name is the HTTP method you want to use. For more details on each endpoint, check the VNDB API documentation.
TIP
Some endpoints have a shorthand. For example, vndb.get.stats()
could be written as vndb.stats()
.
GET /authinfo
Validates and returns information about the given API Token.
Example
import { VNDB } from '@tb-dev/vndb';
const vndb = new VNDB();
const info = await vndb.get.authinfo('MY SECRET');
GET /schema
Returns a JSON object with metadata about several API objects, including enumeration values, which fields are available for querying and a list of supported external links.
- Response: ResponseGetSchema
- Read more: GET /schema
GET /stats
Returns a few overall database statistics.
- Response: ResponseGetStats
- Read more: GET /stats
GET /user
Lookup users by id or username.
- Response: ResponseGetUser
- Read more: GET /user
Example
// Fetch only one user.
const user = await vndb.get.user('u2');
// Fetch many users.
const many = await vndb.get.user(['u1', 'u2', 'u3']);
GET /ulist_labels
Fetch the list labels for a certain user.
- Response: ResponseGetUserListLabels
- Read more: GET /ulist_labels
Example
vndb.get.ulistLabels('u2').then((labels) => console.log(labels));
WARNING
The name of the method is not written in snake_case, as in the endpoint, but in camelCase.
POST /character
- Response: ResponsePostCharacter
- Read more: POST /character
Example
const query = new QueryBuilder({
fields: ['name', 'original', 'age'],
sort: 'name',
results: 10
});
query.filter('search').equal.value('Ame');
const vn = await vndb.post.character(query);
POST /producer
- Response: ResponsePostProducer
- Read more: POST /producer
POST /release
- Response: ResponsePostRelease
- Read more: POST /release
POST /tag
- Response: ResponsePostTag
- Read more: POST /tag
POST /trait
- Response: ResponsePostTrait
- Read more: POST /trait
POST /vn
Query visual novel entries.
- Response: ResponsePostVisualNovel
- Read more: POST /vn
Example
const query = new QueryBuilder();
query.filter('id').equal.value('v1194');
const vn = await vndb.post.vn(query);
PATCH /ulist/<id>
Add or update a visual novel in the user’s list. Requires the listwrite
permission.
- Read more: PATCH /ulist/<id>
Example
const vndb = new VNDB();
vndb.patch.ulist('v6540', {
token: 'MY TOKEN',
vote: 100,
notes: 'Nemu best girl'
});
PATCH /rlist/<id>
Add or update a release in the user’s list. Requires the listwrite
permission. All visual novels linked to the release are also added to the user’s visual novel list, if they aren’t in the list yet.
- Read more: PATCH /rlist/<id>
DELETE /ulist/<id>
Remove a visual novel from the user’s list. Removing a VN also removes any associated releases from the user’s list.
- Read more: DELETE /ulist/<id>
Example
const vndb = new VNDB();
vndb.delete.ulist('v6710', {
token: 'MY TOKEN'
});
DELETE /rlist/<id>
Remove a release from the user’s list. Removing a release does not remove the associated visual novels from the user’s visual novel list, that requires separate calls to DELETE /ulist.
- Read more: DELETE /rlist/<id>