1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "products": [
12 {
13 "id": "EXAMPLE-YOGHURT",
14 "title": "Example low fat strawberry yoghurt 500 g",
15 "market": "EU",
16 "nutrition": {
17 "energy-kcal_100g": 98,
18 "fat_100g": 3.4,
19 "saturated-fat_100g": 2.1,
20 "sugars_100g": 12.5,
21 "proteins_100g": 4.2,
22 "salt_100g": 0.12
23 }
24 },
25 {
26 "id": "EXAMPLE-BAR",
27 "title": "Example high protein cereal bar 40 g",
28 "market": "EU",
29 "nutrition": {
30 "energy-kcal_100g": 410,
31 "fat_100g": 15,
32 "sugars_100g": 22,
33 "fiber_100g": 7.5,
34 "proteins_100g": 18,
35 "salt_100g": 0.4
36 }
37 },
38 {
39 "id": "EXAMPLE-JUICE",
40 "title": "Example apple drink 1 l, no added sugar",
41 "market": "UK",
42 "ingredients": "Water, apple juice from concentrate (30%), glucose-fructose syrup, acid: citric acid",
43 "nutrition": {
44 "energy-kcal_100g": 32,
45 "sugars_100g": 7.6
46 }
47 },
48 {
49 "id": "EXAMPLE-CRACKERS",
50 "title": "Example whole wheat crackers, low sodium, good source of fiber",
51 "market": "US",
52 "nutrition": {
53 "energy-kcal_serving": 120,
54 "sodium_serving": "160 mg",
55 "fiber_serving": 3,
56 "fat_serving": 4
57 }
58 }
59 ]
60};
61
62
63const run = await client.actor("ultimatemc/nutrition-claim-checker").call(input);
64
65
66console.log('Results from dataset');
67console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
68const { items } = await client.dataset(run.defaultDatasetId).listItems();
69items.forEach((item) => {
70 console.dir(item);
71});
72
73