This project provides AWS Lambdas as proxies for several of the HERE Maps APIs. These AWS Lambdas are packaged as per the AWS Serverless Application Model.
“AWS SAM is natively supported by AWS CloudFormation and defines simplified syntax for expressing serverless resources. The specification currently covers APIs, Lambda functions and Amazon DynamoDB tables.”
The AWS API Gateway supports configuring both Cache and Throttling, and the lambdas are open source: we welcome pull requests with circuit breakers, graceful error handling, etc.!
To successfully call the HERE Maps APIs through the proxies in this project you need to obtain HERE API credentials. Multiple plans are available: https://developer.here.com/plans.
- geocode & geocode autocomplete
- mapimage
- maptile
- places
- position
- routing & routing waypoints aka sequence
- tollcost
- traffic
- weather
Visit the here.com Plans overview, and review the Access Control FAQ.
Visit AWS and sign up for a Free Tier account.
Download and install the AWS CLI, and run aws configure as per the AWS CLI User Guide.
From GitHub: clone this repository, or download the ZIP.
The folder containing the lambda source code (JS) and CloudFormation templates (YML) is reInvent2017.
An S3 bucket is required as a destination for the AWS SAM package. If you don't have one already, create one:
aws s3 mb s3://here-maps-api--aws-sam
Note: If the folder contains a package.json file: run npm update:
x:\src\here-aws-repository\reInvent2017\mapimage>npm update
Use the AWS CLI to package (note the folder layout):
x:\src\here-aws-repository\reInvent2017>aws cloudformation package --s3-bucket here-maps-api--aws-sam --template-file geocode\geocode.yml --output-template-file geocode-packaged.yml
Use the AWS CLI to deploy the AWS SAM package using CloudFormation:
x:\src\here-aws-repository\reInvent2017>aws cloudformation deploy --capabilities CAPABILITY_IAM --stack-name "HERE-Maps-API--GeoCode" --parameter-overrides HereAppId=<appID> HereAppCode=<appCode> --template-file geocode-packaged.yml
Once deployment completes, look for the URL of the new API Gateway. It should follow this pattern:
https://<apigw>.execute-api.<region>.amazonaws.com/...
The API Gateway URL is an output from the CloudFormation template and can be found among the tabs when selecting a Stack in the AWS Console.
Alternatively look at the API Gateway in the AWS Console, select Stages, and then expand the tree until you see "Invoke URL".
Note: the AWS Lambda proxies deployed above do not impose authentication or authorization restrictions!
You must decide how you will control access to your API Gateway and Lambdas.
For guidance, see the AWS Lambda FAQ.
Consider implementing AWS API Gateway Custom Authorizers.
The below list of HERE Maps APIs each has one Lambda as a proxy.
An example of an HTTP GET request to HERE.com:
https://geocoder.cit.api.here.com/6.2/geocode.json?app_id=<appID>&app_code=<appCode>&searchtext={searchtext}
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/geocode/{searchtext}
An example of an HTTP GET request to HERE.com:
https://autocomplete.geocoder.cit.api.here.com/6.2/suggest.json?app_id=<appID>&app_code=<appCode>&query={query}
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/geocodesuggest/{query}
An example of an HTTP GET request to HERE.com:
https://image.maps.cit.api.here.com/mia/1.6/mapview?app_id=<appID>&app_code=<appCode>&lat=63.529722&lon=-19.513889
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/mapimage?t=1&lat=63.529722&lon=-19.513889
An example of an HTTP GET request to HERE.com:
https://places.cit.api.here.com/places/v1/autosuggest?app_id=<appID>&app_code=<appCode>&at=40.74917,-73.98529&q=chrysler
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/places?at=40.74917,-73.98529&q=chrysler
Note: this API call requires an HTTP POST. See the Test project for an example payload.
An example of an HTTP POST to HERE.com:
https://pos.cit.api.here.com/positioning/v1/locate?app_id=<appID>&app_code=<appCode>
An example of an HTTP POST to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/position
An example of an HTTP GET request to HERE.com:
https://route.cit.api.here.com/routing/7.2/calculateroute.json?app_id=<appID>&app_code=<appCode>&waypoint0=geo!52.5%2c13.4&waypoint1=geo!52.5%2c13.45&mode=fastest%3bcar%3btraffic:disabled%3b
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/routing?waypoint0=geo!52.5%2c13.4&waypoint1=geo!52.5%2c13.45&mode=fastest%3bcar%3btraffic:disabled%3b
An example of an HTTP GET request to HERE.com:
https://wse.cit.api.here.com/2/findsequence.json?app_id=<appID>&app_code=<appCode>&start=WiesbadenCentralStation%3b50.0715%2c8.2434&destination1=FranfurtCentralStation%3b50.1073%2c8.6647&destination2=DarmstadtCentralStation%3b49.8728%2c8.6326&destination3=FrankfurtAirport%3b50.0505%2c8.5698&destination4=HanauCentralStation%3b50.1218%2c8.9298&end=MainzCentralStation%3b50.0021%2c8.259&improveFor=time&departure=2014-12-09T09:30:00%2b01:00&mode=fastest%3bcar%3btraffic:disabled%3b
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/waypointseq?start=WiesbadenCentralStation%3b50.0715%2c8.2434&destination1=FranfurtCentralStation%3b50.1073%2c8.6647&destination2=DarmstadtCentralStation%3b49.8728%2c8.6326&destination3=FrankfurtAirport%3b50.0505%2c8.5698&destination4=HanauCentralStation%3b50.1218%2c8.9298&end=MainzCentralStation%3b50.0021%2c8.259&improveFor=time&departure=2014-12-09T09:30:00%2b01:00&mode=fastest%3bcar%3btraffic:disabled%3b
An example of an HTTP GET request to HERE.com:
https://tce.cit.api.here.com/2/calculateroute.json?app_id=<appID>&app_code=<appCode>&waypoint0=49.33729606975952%2c0.5986232869327068&waypoint1=49.493527937780975%2c0.10129541603788539&mode=fastest%3bcar%26cost_optimize%3d1
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/tollcost?waypoint0=49.33729606975952%2c0.5986232869327068&waypoint1=49.493527937780975%2c0.10129541603788539&mode=fastest%3bcar%26cost_optimize%3d1
An example of an HTTP GET request to HERE.com:
https://traffic.cit.api.here.com/traffic/6.2/incidents/json/8/134/86?app_id=<appID>&app_code=<appCode>
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/traffic/8/134/86
Note: the Weather API is not available by default. Please contact the here.com Sales Team for more information.
An example of an HTTP GET request to HERE.com:
https://weather.cit.api.here.com/weather/1.0/report.json?app_id=<appID>&app_code=<appCode>&product=observation&name=Berlin-Tegel
To call the Lambda proxy instead, replace the original URL with the API Gateway URL and change the Query String Parameters as follows:
An example of an HTTP GET request to the equivalent AWS Lambda Proxy:
https://<apigw>.execute-api.<region>.amazonaws.com/Stage/weather?product=observation&name=Berlin-Tegel
Copyright (c) 2017 HERE Europe B.V.
See the LICENSE file in the root of this project for license details.