Full-coverage REST API

If you are doing a server side implementation, directly hitting the REST API may be your best choice. If you are developing on the server with NodeJS, be aware that the core javascript library for JS/TS is compatible with NodeJS.

Take a look at our official REST API documentation for detailed information on how to use it.

The Basics

Once you have obtained your apikey, you can start making requests to the Targomo API directly. As a brief primer, here’s how to go about requesting GeoJSON polygons:

Here’s an example configuration for requesting a GeoJSON polygon representing a 30-minute walkshed in Berlin

{
    "sources": [{
        "lat": 52.52,
        "lng": 13.405,
        "id": "id123",
        "tm": {
            "walk": {}
        }
    }],
    "polygon": {
        "serializer": "geojson",
        "srid": 4326,
        "values": [1800]
    }
}

And the configuration in a cURL POST request (`--compressed` to unzip the response)
curl --compressed -X POST \
  'https://service.targomo.com/westcentraleurope/v1/polygon_post?key=__targomo_key_here__' \
  -H 'Content-Type: application/json' \
  -d '{
    "sources": [{
        "lat": 52.52,
        "lng": 13.405,
        "id": "id123",
        "tm": {
            "walk": {}
        }
    }],
    "polygon": {
        "serializer": "geojson",
        "srid": 4326,
        "values": [1800]
    }
}'

The response data are in a json key `data`, so if we use jq, we can access this data directly and pipe to file
curl --compressed -X POST \
  'https://service.targomo.com/westcentraleurope/v1/polygon_post?key=__targomo_key_here__' \
  -H 'Content-Type: application/json' \
  -d '{
    "sources": [{
        "lat": 52.52,
        "lng": 13.405,
        "id": "id123",
        "tm": {
            "walk": {}
        }
    }],
    "polygon": {
        "serializer": "geojson",
        "srid": 4326,
        "values": [1800]
    }
}' | jq .data > berlin_30_min_walk.geojson