Creating a C#/ .net service to do Google Places API look up

The application I am working on requires address autocomplete feature, there are few paid services that do this already, but I choose Google Places API – its free (well I don’t expect to eat up quota – my app no way near the limitation).

Google Places API does not return the postcode on the “autocomplete” endpoint (at least to my knowledge – according to documentation), therefore you will need to to another GET request by the Place ID to get the postcode.

I am going to use my favorite packages to help with this development, Newtonsoft.Json and AutoMapper.

Below are the JSON objects

Automapper profile

Here is the IGooglePlacesService Interface.

Here is the implementation

Hope this helps

Leave a comment