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": "EXAMPLE-001",
14 "title": "Example Widget 2-Pack",
15 "vendor": "Vendor A",
16 "price": "$24.99",
17 "shipping": "free"
18 },
19 {
20 "asin": "EXAMPLE-001",
21 "title": "Example Widget 2-Pack",
22 "vendor": "Vendor B",
23 "price": "21,50 €",
24 "shipping": "3,00 €"
25 },
26 {
27 "asin": "EXAMPLE-001",
28 "title": "Example Widget 2-Pack",
29 "vendor": "Vendor C",
30 "price": 26.4,
31 "currency": "USD"
32 },
33 {
34 "asin": "EXAMPLE-002",
35 "title": "Example Gadget Mini",
36 "vendor": "Vendor A",
37 "price": "$12.00",
38 "shipping": 4.5,
39 "availability": "In stock"
40 },
41 {
42 "asin": "EXAMPLE-002",
43 "title": "Example Gadget Mini",
44 "vendor": "Vendor B",
45 "price": "11,20 €",
46 "shipping": "2,50 €",
47 "availability": "Out of stock"
48 }
49 ],
50 "fxRates": {
51 "EUR": 1.08
52 },
53 "vendorFees": {
54 "Vendor A": {
55 "percent": 15,
56 "fixed": 0.3
57 },
58 "Vendor B": {
59 "percent": 8
60 }
61 }
62};
63
64
65const run = await client.actor("practical_ai_lab_jp/pal-amazon-competitor-offer-matrix").call(input);
66
67
68console.log('Results from dataset');
69console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
70const { items } = await client.dataset(run.defaultDatasetId).listItems();
71items.forEach((item) => {
72 console.dir(item);
73});
74
75