🍿 @lorenzopant/tmdb

Add Items

Add one or more movies or TV shows to a v4 list.

Adds one or more movies or TV shows to a list in a single request. The response contains a per-item result so you can check whether each item was added successfully.

async add_items(list_id: number, body: V4AddListItemsBody): Promise<V4AddListItemsResponse>

TMDB Reference: Add Items

Parameters

NameTypeRequiredDescription
list_idnumberThe TMDB list ID.

Body

NameTypeRequiredDescription
itemsV4ListItemInput[]Array of items to add. Each item requires media_type and media_id.

V4ListItemInput fields:

NameTypeRequiredDescription
media_type"movie" | "tv"The TMDB media type.
media_idnumberThe TMDB media ID.
commentstringOptional free-text note about this item.

Returns

V4AddListItemsResponse

Errors

HTTPTMDB codeCause
4013Invalid or missing access token.
40434List not found.

Example

import { TMDB } from "@lorenzopant/tmdb";

const tmdb = new TMDB("your-access-token");

const { results } = await tmdb.v4.lists.add_items(8700, {
	items: [
		{ media_type: "movie", media_id: 550, comment: "Brad Pitt at his best" },
		{ media_type: "tv", media_id: 1396 },
	],
});

results.forEach(({ media_type, media_id, success }) => {
	console.log(`${media_type}:${media_id} added: ${success}`);
});

On this page