Integratiegids — Node.js / TypeScript

GeoFetch Apify actors integreren in Node.js & TypeScript

Gebruik de officiële npm apify-client om geodata-actors aan te roepen vanuit je backend of serverless functies.

Relevante termen & koppelingen

Apify Node.js SDK apify-client npm TypeScript geodata API RDW API Node.js PDOK geocoding JavaScript

Stap-voor-stap handleiding

1

Installeer apify-client via npm of pnpm

Voeg het officiële Apify client pakket toe aan je project.

bash
npm install apify-client
2

Initialiseer de ApifyClient in TypeScript / ES Modules

Importeer de client en maak een instantie aan met je API token.

typescript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({
  token: process.env.APIFY_TOKEN,
});
3

Roep de Actor aan en verwerk de Dataset

Voorbeeld voor de PDOK Locatieserver geocoding actor (`codeclouds/pdok-locatieserver`).

typescript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({
  token: process.env.APIFY_TOKEN,
});

async function geocodeAddress(query: string) {
  const runInput = {
    query,
    includeCbsStats: true,
  };

  // Start actor en wacht op afronding
  const run = await client.actor('codeclouds/pdok-locatieserver').call(runInput);

  // Ophalen gegenereerde dataset items
  const { items } = await client.dataset(run.defaultDatasetId).listItems();
  return items;
}

// Voorbeeld aanroep
geocodeAddress('Dam 1, Amsterdam').then(console.log);
4

Gebruik Native Fetch API (Zero Dependency)

Aanroep zonder externe libraries via de Apify REST API `run-sync-get-dataset-items` endpoint.

javascript
const token = process.env.APIFY_TOKEN;
const url = `https://api.apify.com/v2/acts/codeclouds~pdok-locatieserver/run-sync-get-dataset-items?token=${token}`;

const response = await fetch(url, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: 'Spui 1, Den Haag' }),
});

const items = await response.json();
console.log(items);

Populaire actors voor Node.js / TypeScript

NL Adres Geocoding & Buurtdata — PDOK + CBS

Zoek een NL adres, postcode of coördinaat op — geocoding, reverse geocoding en lookup in 1 call via de gratis PDOK-API. Output: WGS84+RD-coördinaten, BAG-ID's, optioneel CBS-buurtdata. Bespaart 3 API-integraties + RD-conversie. Bulk-verwerking, retries. Vanaf $1,50/1.000 (PPE).

Vanaf $0,0015 per adres ($1,50 per 1.000)

Bekijk op Apify

NL Netcongestie Monitor (Netcapaciteit per Postcode)

Check de netcongestiestatus van het Nederlandse elektriciteitsnet per postcode of adres — afname- en invoedstatus, wachtrijgrootte (MW) — rechtstreeks van de officiële landelijke Capaciteitskaart (Netbeheer Nederland + TenneT).

Vanaf $0,01 per locatie

Bekijk op Apify

NL Parkeertarieven & Live Beschikbaarheid Monitor

Actuele tarieven en real-time vrije-plekken-tellingen voor Nederlandse parkeergarages, rechtstreeks uit RDW's landelijke Open Parkeerdata-feed. Detecteert wijzigingen in de livestatus van een garage tussen runs.

Vanaf $0,003 per garage

Bekijk op Apify

Veelgestelde vragen

Werkt dit in Next.js Server Actions of Vercel Serverless Functions?

Absoluut! Zowel `apify-client` als de native `fetch` aanpak werken uitstekend in serverless Node.js / Next.js environments.

Hoe stel ik timeouts in voor lange runs?

Bij `client.actor(...).call(input, { timeout: 60 })` kun je de maximale wachttijd in seconden opgeven.

Klaar om je geodata-workflow te bouwen?

Alle actors draaien op Apify onder je eigen account. Start meteen met je gratis Apify API token.

Bekijk alle GeoFetch actors →