1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "baseline": {
12 "sourceType": "inline",
13 "label": "Approved catalog",
14 "format": "auto",
15 "items": [
16 {
17 "sku": "PHX-100",
18 "title": "Example black mug",
19 "price": "19.99",
20 "currency": "EUR",
21 "stock": "in stock",
22 "image_url": "https://example.com/images/mug.jpg",
23 "product_url": "https://example.com/products/mug"
24 },
25 {
26 "sku": "PHX-200",
27 "title": "Example desk mat",
28 "price": "29.99",
29 "currency": "EUR",
30 "stock": "in stock",
31 "image_url": "https://example.com/images/mat.jpg",
32 "product_url": "https://example.com/products/mat"
33 }
34 ]
35 },
36 "current": {
37 "sourceType": "inline",
38 "label": "Current catalog",
39 "format": "auto",
40 "items": [
41 {
42 "sku": "PHX-100",
43 "title": "Example black mug",
44 "price": "21.99",
45 "currency": "EUR",
46 "stock": "out of stock",
47 "image_url": "",
48 "product_url": "https://example.com/products/mug"
49 },
50 {
51 "sku": "PHX-300",
52 "title": "Example laptop stand",
53 "price": "39.99",
54 "currency": "EUR",
55 "stock": "in stock",
56 "image_url": "https://example.com/images/stand.jpg",
57 "product_url": "https://example.com/products/stand"
58 }
59 ]
60 }
61};
62
63
64const run = await client.actor("phoenix-tools/phoenix-catalog-proof").call(input);
65
66
67console.log('Results from dataset');
68console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
69const { items } = await client.dataset(run.defaultDatasetId).listItems();
70items.forEach((item) => {
71 console.dir(item);
72});
73
74