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-COOKIES",
14 "title": "Example chocolate chip cookies",
15 "ingredients": "Enriched wheat flour, sugar, chocolate chips (sugar, cocoa butter, milk fat), butter, eggs, pecans, salt, soy lecithin.",
16 "contains": "Contains: wheat, milk, egg, soy."
17 },
18 {
19 "id": "EXAMPLE-GRANOLA",
20 "title": "Example nut-free granola",
21 "claims": "Nut-free",
22 "ingredients": "Rolled oats, honey, sunflower seeds, coconut. May contain peanuts and tree nuts."
23 },
24 {
25 "id": "EXAMPLE-CURRY",
26 "title": "Example coconut curry sauce",
27 "ingredients": "Coconut milk, water, onion, nutmeg, butternut squash, salt, spices.",
28 "contains": "Contains: coconut."
29 },
30 {
31 "id": "EXAMPLE-CRACKERS",
32 "title": "Example sesame crackers",
33 "ingredients": "Wheat flour, sesame seeds, olive oil, salt.",
34 "contains": "Contains: wheat, sesame."
35 }
36 ]
37};
38
39
40const run = await client.actor("ultimatemc/food-allergen-label-checker").call(input);
41
42
43console.log('Results from dataset');
44console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
45const { items } = await client.dataset(run.defaultDatasetId).listItems();
46items.forEach((item) => {
47 console.dir(item);
48});
49
50