Synchronize items in a specific list with a provided set of items. This endpoint performs a comprehensive synchronization that:
This is ideal for keeping a list in sync with an external data source.
Take the list id from the url on the Make a List page for your list. Your topic id can be taken from the url on your lists page. It will look something like "oliver-user".
curl -X POST "<https://unduel.com/api/v1/list/synchronize-items?user=><user name>" \\
-H "X-API-Key: <api key>" \\
-H "Content-Type: application/json" \\
-d '{
"listId": "<list id>",
"topicId": "<topic id>",
"items": [
{
"name": "New Item Name",
"subtitle": "Item Subtitle",
"nameRef": "new-item-name",
"imageUrl": "<https://example.com/image.jpg>",
"imageWidth": 400,
"imageHeight": 400,
"pixelated": false,
"description": "Item description",
"tags": ["tag1", "tag2"],
"properties": {"key": "value"},
"source": "<https://source.com>",
"wikiUrl": "<https://wiki.com/item>"
},
{
"id": "<existing item id>",
"name": "Updated Existing Item",
"subtitle": "Updated Subtitle",
"nameRef": "updated-item",
"imageUrl": "<https://example.com/updated-image.jpg>",
"imageWidth": 500,
"imageHeight": 500,
"pixelated": false,
"description": "Updated description",
"tags": ["updated-tag1", "updated-tag2"],
"properties": {"updated-key": "updated-value"},
"source": "<https://updated-source.com>",
"wikiUrl": "<https://wiki.com/updated-item>"
}
]
}'
interface SynchronizeItemsRequestBody {
listId: string;
topicId: string;
items: EditableItem[];
}
interface EditableItem {
/** Item ID (optional for new items)
Item ID is recommended for making item edits.
However, you can exclude the id and instead look up items by nameRef
as long as there are no duplicate nameRefs on the list / item set.
*/
id?: string;
/** Item name */
name: string;
/** Optional subtitle */
subtitle: string | null;
/** URL-safe slug */
nameRef: string;
/** Image URL */
imageUrl: string | null;
/** Image dimensions, required for new items with imageUrls */
imageWidth: number | null;
imageHeight: number | null;
/** Is the image pixel art? */
pixelated: boolean | null;
/** Item description */
description: string | null;
/** Array of tag names to apply for filtering */
tags: string[];
/** Custom properties as key-value pairs */
properties: { [key: string]: string };
/** Source of information for item */
source: string | null;
/** Wiki url for more info on item */
wikiUrl:
}
interface SynchronizeItemsResponse {
success: boolean;
message?: string; // Includes counts of created, updated, and archived items
error?: string;
}