1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "records": [
12 {
13 "id": "blue-variant",
14 "url": "https://shop.example/shirt?color=blue",
15 "sku": "SKU-BLUE",
16 "price": "24.90",
17 "currency": "USD",
18 "availability": "in_stock",
19 "gtin": "0012345678905"
20 },
21 {
22 "id": "wrong-currency",
23 "url": "https://shop.example/mug",
24 "sku": "MUG",
25 "price": "24.90",
26 "currency": "USD",
27 "availability": "in_stock"
28 },
29 {
30 "id": "conflicting-prices",
31 "url": "https://shop.example/lamp",
32 "sku": "LAMP",
33 "price": "24.90",
34 "currency": "USD",
35 "availability": "in_stock"
36 },
37 {
38 "id": "stock-unknown",
39 "url": "https://shop.example/hat",
40 "sku": "HAT",
41 "price": "24.90",
42 "currency": "USD",
43 "availability": "in_stock"
44 },
45 {
46 "id": "broken-markup",
47 "url": "https://shop.example/bag",
48 "sku": "BAG",
49 "price": "24.90",
50 "currency": "USD",
51 "availability": "in_stock"
52 },
53 {
54 "id": "group-review",
55 "url": "https://shop.example/shoe",
56 "sku": "SHOE",
57 "price": "24.90",
58 "currency": "USD",
59 "availability": "in_stock"
60 },
61 {
62 "id": "snapshot-needed",
63 "url": "https://shop.example/missing",
64 "sku": "NONE",
65 "price": "24.90",
66 "currency": "USD",
67 "availability": "in_stock"
68 }
69 ],
70 "pages": [
71 {
72 "url": "https://shop.example/shirt?color=blue",
73 "html": "<!doctype html><html><head><script>/* theme */</script><script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Product\",\"sku\":\"SKU-RED\",\"offers\":{\"@type\":\"Offer\",\"price\":\"19.90\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"}},{\"@type\":\"Product\",\"sku\":\"SKU-BLUE\",\"offers\":{\"@type\":\"Offer\",\"price\":\"24.90\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"},\"gtin13\":\"0012345678905\"}]}</script></head><body>Shirt</body></html>",
74 "fetchedAt": "2026-09-29T09:00:00Z"
75 },
76 {
77 "url": "https://shop.example/mug",
78 "jsonLd": "{\"@type\":\"Product\",\"sku\":\"MUG\",\"offers\":{\"@type\":\"Offer\",\"price\":\"24.90\",\"priceCurrency\":\"EUR\",\"availability\":\"https://schema.org/InStock\"}}"
79 },
80 {
81 "url": "https://shop.example/lamp",
82 "jsonLd": "{\"@type\":\"Product\",\"sku\":\"LAMP\",\"offers\":[{\"@type\":\"Offer\",\"price\":\"24.90\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"},{\"@type\":\"Offer\",\"price\":\"29.90\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"}]}"
83 },
84 {
85 "url": "https://shop.example/hat",
86 "jsonLd": "{\"@type\":\"Product\",\"sku\":\"HAT\",\"offers\":{\"@type\":\"Offer\",\"price\":\"24.90\",\"priceCurrency\":\"USD\"}}"
87 },
88 {
89 "url": "https://shop.example/bag",
90 "jsonLd": "{\"@type\": \"Product\", broken"
91 },
92 {
93 "url": "https://shop.example/shoe",
94 "jsonLd": "{\"@type\":\"ProductGroup\",\"hasVariant\":[{\"@type\":\"Product\",\"sku\":\"SHOE\",\"offers\":{\"@type\":\"Offer\",\"price\":\"24.90\",\"priceCurrency\":\"USD\",\"availability\":\"https://schema.org/InStock\"}}]}"
95 }
96 ]
97};
98
99
100const run = await client.actor("h_murdock/merchant-feed-offer-audit").call(input);
101
102
103console.log('Results from dataset');
104console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
105const { items } = await client.dataset(run.defaultDatasetId).listItems();
106items.forEach((item) => {
107 console.dir(item);
108});
109
110