1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "rows": [
12 {
13 "title": "Trailblazer 40L Hiking Backpack",
14 "sku": "NP-BP-040",
15 "price": "$89.99",
16 "inStock": true,
17 "rating": 4.6,
18 "url": "https://shop.northpeak.example/p/trailblazer-40?utm_source=feed",
19 "seller": {
20 "name": "NorthPeak Outfitters",
21 "country": "US"
22 },
23 "listedAt": "2026-10-28T09:15:00Z"
24 },
25 {
26 "title": "Summit Down Jacket",
27 "sku": "NP-JK-210",
28 "price": "$249.00",
29 "inStock": true,
30 "rating": 4.8,
31 "url": "https://shop.northpeak.example/p/summit-down-jacket",
32 "seller": {
33 "name": "NorthPeak Outfitters",
34 "country": "US"
35 },
36 "listedAt": "2026-10-29T16:40:00Z"
37 },
38 {
39 "title": "Ridge Trekking Poles (pair)",
40 "sku": "CL-TP-002",
41 "price": "$54.50",
42 "inStock": false,
43 "rating": 4.3,
44 "url": "https://cliffline.example/gear/ridge-poles",
45 "seller": {
46 "name": "Cliffline Gear",
47 "country": "CA"
48 },
49 "listedAt": "Oct 30, 2026"
50 },
51 {
52 "title": "Lumen 400 Headlamp",
53 "sku": "BR-HL-400",
54 "price": "$29.95",
55 "inStock": true,
56 "rating": 4.6,
57 "url": "https://www.brightway.example/headlamps/lumen-400",
58 "seller": {
59 "name": "Brightway Supply",
60 "country": "GB"
61 },
62 "listedAt": "2026-11-02 14:05"
63 },
64 {
65 "title": "Trailblazer 40L Hiking Backpack",
66 "sku": "np-bp-040",
67 "price": "$89.99",
68 "inStock": true,
69 "rating": 4.6,
70 "url": "https://shop.northpeak.example/p/trailblazer-40",
71 "seller": {
72 "name": "NorthPeak Outfitters",
73 "country": "US"
74 },
75 "listedAt": "2026-11-03T08:00:00Z"
76 },
77 {
78 "title": "Alpine 2-Person Tent",
79 "sku": "CL-TN-200",
80 "price": "$189.00",
81 "inStock": true,
82 "rating": 4.4,
83 "url": "https://cliffline.example/gear/alpine-2p",
84 "seller": {
85 "name": "Cliffline Gear",
86 "country": "CA"
87 },
88 "listedAt": "Nov 1, 2026"
89 },
90 {
91 "title": "Merino Hiking Socks (3 pack)",
92 "sku": "WB-SK-003",
93 "price": "$24.00",
94 "inStock": true,
95 "rating": 4.7,
96 "url": "https://woolbridge.example/socks/merino-3",
97 "seller": {
98 "name": "Woolbridge Co",
99 "country": "NZ"
100 },
101 "listedAt": "2026-10-27T11:20:00Z"
102 },
103 {
104 "title": "Canyon Water Filter",
105 "sku": "BR-WF-100",
106 "price": "",
107 "inStock": true,
108 "rating": null,
109 "url": "https://www.brightway.example/water/canyon-filter",
110 "seller": {
111 "name": "Brightway Supply",
112 "country": "GB"
113 },
114 "listedAt": "2026-11-04T10:00:00Z"
115 },
116 {
117 "title": "Glacier Insulated Bottle 1L",
118 "sku": "WB-BT-001",
119 "price": "$32.00",
120 "inStock": true,
121 "rating": 4.6,
122 "url": "https://woolbridge.example/bottles/glacier-1l",
123 "seller": {
124 "name": "Woolbridge Co",
125 "country": "NZ"
126 },
127 "listedAt": "Oct 31, 2026"
128 },
129 {
130 "title": "Basecamp Camp Stove",
131 "sku": "CL-ST-050",
132 "price": "$74.99",
133 "inStock": "yes",
134 "rating": 4.2,
135 "url": "https://cliffline.example/gear/basecamp-stove",
136 "seller": {
137 "name": "Cliffline Gear",
138 "country": "CA"
139 },
140 "listedAt": "2026-11-05 09:30"
141 }
142 ],
143 "transforms": [
144 {
145 "op": "cast",
146 "field": "price",
147 "to": "number"
148 },
149 {
150 "op": "compute",
151 "field": "priceWithTax",
152 "expression": "price * 1.2",
153 "round": 2
154 },
155 {
156 "op": "extractDomain",
157 "field": "url",
158 "into": "shop"
159 },
160 {
161 "op": "dateFormat",
162 "field": "listedAt",
163 "format": "date"
164 }
165 ],
166 "filters": [
167 {
168 "field": "inStock",
169 "operator": "isTrue"
170 },
171 {
172 "field": "price",
173 "operator": "lessThan",
174 "value": 200
175 }
176 ],
177 "dedupeFields": [
178 "sku"
179 ],
180 "sortBy": [
181 "rating desc",
182 "price"
183 ],
184 "outputFields": [
185 "title",
186 "sku",
187 "price",
188 "priceWithTax",
189 "rating",
190 "shop",
191 "seller.name -> seller",
192 "listedAt"
193 ]
194};
195
196
197const run = await client.actor("saliga/dataset-filter-transform").call(input);
198
199
200console.log('Results from dataset');
201console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
202const { items } = await client.dataset(run.defaultDatasetId).listItems();
203items.forEach((item) => {
204 console.dir(item);
205});
206
207