1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "observations": [
12 {
13 "marketplace": "amazon",
14 "gtin": "00036000291452",
15 "productId": "B0EXAMPLE",
16 "title": "Sample product",
17 "price": 12.99,
18 "currency": "USD",
19 "rating": 4.4,
20 "reviewCount": 225,
21 "productUrl": "https://www.amazon.com/dp/B0EXAMPLE",
22 "imageUrl": "https://example.com/image.jpg"
23 },
24 {
25 "marketplace": "walmart",
26 "gtin": "00036000291452",
27 "productId": "123456789",
28 "title": "Sample product",
29 "price": 11.99,
30 "currency": "USD",
31 "rating": 4.2,
32 "reviewCount": 44,
33 "productUrl": "https://www.walmart.com/ip/123456789"
34 }
35 ]
36};
37
38
39const run = await client.actor("rustic_soybean/exact-sku-shopping-comparison").call(input);
40
41
42console.log('Results from dataset');
43console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49