1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "nodes": [
12 {
13 "name": "Fetch",
14 "type": "example.fetch",
15 "typeVersion": 1,
16 "credentials": {
17 "exampleApi": {
18 "id": "source-id",
19 "name": "service-alias"
20 }
21 }
22 }
23 ],
24 "targetCredentials": [
25 {
26 "id": "target-id",
27 "name": "service-alias",
28 "type": "exampleApi"
29 }
30 ],
31 "targetNodeTypes": [
32 {
33 "type": "example.fetch",
34 "supportedVersions": [
35 1,
36 2
37 ]
38 }
39 ]
40};
41
42
43const run = await client.actor("salim-operator-labs/my-actor").call(input);
44
45
46console.log('Results from dataset');
47console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
48const { items } = await client.dataset(run.defaultDatasetId).listItems();
49items.forEach((item) => {
50 console.dir(item);
51});
52
53