1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "reviews": [
12 {
13 "userId": "R1",
14 "date": "2026-03-02",
15 "ratingScore": 2,
16 "reviewDescription": "The left earbud stopped charging after about four months. Case shows it at 100% but it is dead."
17 },
18 {
19 "userId": "R2",
20 "date": "2026-03-19",
21 "ratingScore": 1,
22 "reviewDescription": "Left bud stopped charging completely around month five. Right one is fine."
23 },
24 {
25 "userId": "R3",
26 "date": "2026-04-07",
27 "ratingScore": 2,
28 "reviewDescription": "Battery died on the left earbud after four months of light use. Very disappointing."
29 },
30 {
31 "userId": "R4",
32 "date": "2026-02-11",
33 "ratingScore": 1,
34 "reviewDescription": "Case hinge snapped in my pocket within a few weeks. The plastic is far too thin."
35 },
36 {
37 "userId": "R5",
38 "date": "2026-05-02",
39 "ratingScore": 2,
40 "reviewDescription": "The hinge on the charging case broke after about three weeks of normal use."
41 },
42 {
43 "userId": "R6",
44 "date": "2026-05-14",
45 "ratingScore": 1,
46 "reviewDescription": "Hinge cracked and now the case will not stay shut at all."
47 },
48 {
49 "userId": "R7",
50 "date": "2026-01-30",
51 "ratingScore": 3,
52 "reviewDescription": "Did not like the colour, it is more grey than silver in person."
53 }
54 ],
55 "productName": "Wireless Earbuds (example)",
56 "linkUrl": "https://www.amazon.com/dp/B08EXAMPLE"
57};
58
59
60const run = await client.actor("pradio/amazon-defect-ledger").call(input);
61
62
63console.log('Results from dataset');
64console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
65const { items } = await client.dataset(run.defaultDatasetId).listItems();
66items.forEach((item) => {
67 console.dir(item);
68});
69
70