1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "offers": [
12 {
13 "asin": "B0SAMPLE01",
14 "seller": "Seller A",
15 "price": 12.99,
16 "currency": "USD",
17 "packCount": 1,
18 "unitSize": 32,
19 "unit": "oz"
20 },
21 {
22 "asin": "B0SAMPLE01",
23 "seller": "Seller B",
24 "price": 9.99,
25 "currency": "USD",
26 "packCount": 1,
27 "unitSize": 12,
28 "unit": "oz"
29 },
30 {
31 "asin": "B0SAMPLE01",
32 "seller": "Seller C",
33 "price": 24.5,
34 "currency": "USD",
35 "packCount": 2,
36 "unitSize": 16,
37 "unit": "oz"
38 },
39 {
40 "asin": "B0SAMPLE01",
41 "seller": "Seller D",
42 "price": 11.5,
43 "currency": "USD",
44 "unitSize": 24,
45 "unit": "oz"
46 },
47 {
48 "asin": "B0SAMPLE02",
49 "seller": "Seller A",
50 "price": 8,
51 "currency": "USD",
52 "packCount": 4,
53 "unit": "count"
54 },
55 {
56 "asin": "B0SAMPLE02",
57 "seller": "Seller B",
58 "price": 14,
59 "currency": "USD",
60 "packCount": 12,
61 "unit": "count"
62 },
63 {
64 "asin": "B0SAMPLE02",
65 "seller": "Seller E",
66 "price": 12,
67 "currency": "EUR",
68 "packCount": 6,
69 "unit": "count"
70 }
71 ]
72};
73
74
75const run = await client.actor("practical_ai_lab_jp/pal-amazon-unit-price-pack-size-audit").call(input);
76
77
78console.log('Results from dataset');
79console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
80const { items } = await client.dataset(run.defaultDatasetId).listItems();
81items.forEach((item) => {
82 console.dir(item);
83});
84
85