1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "products": [
12 {
13 "id": "sku-1",
14 "title": "Women's waterproof hiking boots",
15 "description": "Leather trail boots with rubber sole",
16 "brand": "North Peak"
17 }
18 ],
19 "taxonomy": [
20 {
21 "id": "footwear-boots",
22 "name": "Hiking Boots",
23 "path": "Apparel > Footwear > Boots",
24 "keywords": [
25 "hiking",
26 "trail",
27 "trekking",
28 "waterproof"
29 ]
30 },
31 {
32 "id": "footwear-sneakers",
33 "name": "Sneakers",
34 "path": "Apparel > Footwear > Sneakers",
35 "keywords": [
36 "sneaker",
37 "trainer",
38 "running"
39 ]
40 }
41 ]
42};
43
44
45const run = await client.actor("webdata_labs/ai-product-taxonomy-mapper-api").call(input);
46
47
48console.log('Results from dataset');
49console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
50const { items } = await client.dataset(run.defaultDatasetId).listItems();
51items.forEach((item) => {
52 console.dir(item);
53});
54
55