1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "locations": [
12 {
13 "name": "Oslo",
14 "latitude": 59.9139,
15 "longitude": 10.7522
16 },
17 {
18 "name": "Milan",
19 "latitude": 45.4642,
20 "longitude": 9.19
21 },
22 {
23 "name": "Sydney",
24 "latitude": -33.8688,
25 "longitude": 151.2093
26 }
27 ],
28 "forecastDays": 3,
29 "outputMode": "location",
30 "timeStep": "hourly",
31 "units": "metric"
32};
33
34
35const run = await client.actor("far003/weather-forecast-met-norway").call(input);
36
37
38console.log('Results from dataset');
39console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
40const { items } = await client.dataset(run.defaultDatasetId).listItems();
41items.forEach((item) => {
42 console.dir(item);
43});
44
45