1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "items": [
12 {
13 "name": "Example site A",
14 "site": {
15 "region": "West Midlands",
16 "lat": 52.4862,
17 "lon": -1.8904
18 },
19 "start": "2026-11-02",
20 "tags": [
21 "solar",
22 "battery"
23 ],
24 "capacityMw": 12.5,
25 "live": true,
26 "url": "https://example.com/a"
27 },
28 {
29 "name": "Example site B, phase 2",
30 "site": {
31 "region": "East of England",
32 "lat": 52.2053,
33 "lon": 0.1218
34 },
35 "start": "2027-01-15",
36 "tags": [
37 "wind"
38 ],
39 "capacityMw": 40,
40 "live": false,
41 "url": "https://example.com/b"
42 },
43 {
44 "name": "=Example site C",
45 "site": {
46 "region": "London",
47 "lat": 51.5072,
48 "lon": -0.1276
49 },
50 "start": "2026-12-01T09:30:00Z",
51 "tags": [],
52 "capacityMw": null,
53 "live": true,
54 "url": "https://example.com/c"
55 }
56 ],
57 "targets": [
58 "excel-uk-csv",
59 "sql-postgres",
60 "dataverse",
61 "ics",
62 "geojson",
63 "xlsx"
64 ],
65 "tableName": "sites",
66 "icsMapping": {
67 "summary": "name",
68 "start": "start",
69 "location": "site.region"
70 },
71 "geoMapping": {
72 "lat": "site.lat",
73 "lon": "site.lon",
74 "name": "name"
75 }
76};
77
78
79const run = await client.actor("landlordtools/dataset-format-converter").call(input);
80
81
82console.log('Results from dataset');
83console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
84const { items } = await client.dataset(run.defaultDatasetId).listItems();
85items.forEach((item) => {
86 console.dir(item);
87});
88
89