October 2017
Intermediate to advanced
440 pages
11h 47m
English
Arguments are passed to REST methods in one of two possible ways: in a query string or using the Body parameter.
The Google geocoding API expects address as an argument:
https://developers.google.com/maps/documentation/geocoding/start
When using a query string any reserved characters must be replaced. For example, spaces in a query string must be replaced with %20 or +. The .NET framework provides a means of changing reserved characters using the HttpUtility class:
# HttpUtility is not available without loading System.Web Add-Type -AssemblyName System.Web $address = '221b Baker St, Marylebone, London NW1 6XE' $address = [System.Web.HttpUtility]::UrlEncode($address) Invoke-RestMethod -Uri "https://maps.googleapis.com/maps/api/geocode/json?address=$address" ...
Read now
Unlock full access