Google Place Autocomplete Connector

Content Type: Module
Categories: Connectors

Overview

You can use this connector from any Mendix application when you want to show address suggestions while a user is providing input by typing. This feature helps the user to fill in its address details faster and without having to fully type it out.   

The Google Place Autocomplete Connector is a module containing a plug-and-play integration with the Google Maps platform. With this module, you can setup the Place Autocomplete API by creating an AutocompleteRequest and calling the exposed microflow POST_v1_Google_PlaceAutocomplete. When a user has entered its address using the autocomplete function, a call to POST_v1_Google_PlaceDetails can be made to extract the address information from the location.  

Full documentation on Place Autocomplete and Place Details APIs can be found on Google:
https://developers.google.com/maps/documentation/places/web-service/autocomplete
https://developers.google.com/maps/documentation/places/web-service/details

You can download an example module for this connector on the Mendix Marketplace as well:
https://marketplace.mendix.com/link/component/207392

 

Documentation

Description

The Google Place Autocomplete Connector is a module containing a plug-and-play integration with the Google Maps platform. With this module, you can setup the Place Autocomplete API by creating an AutocompleteRequest and calling the exposed microflow POST_v1_Google_PlaceAutocomplete. When a user has entered its address using the autocomplete function, a call to POST_v1_Google_PlaceDetails can be made to extract the address information from the location.  

Typical usage scenario

You can use this connector from any Mendix application when you want to show address suggestions while a user is providing input by typing. This feature helps the user to fill in its address details faster and without having to fully type it out.  

Features

  • Post Autocomplete: based on options such as components, language, region and types, the connector will connect to the Google Maps API and provide predictions on the address that the user is typing.
  • Post Details: based on the PlaceID resulting from the autocomplete response, the connector will obtain detailed information about the location from the Google Maps API.

Dependencies

Mendix 9.12.1 or higher.

Installation & Configuration

To use this connector, follow these steps (this can also be found in the Read me of the module): 

  1. You need a Google API key for this connector to work. If you don't already have one, you can create one here: https://developers.google.com/maps/documentation/places/web-service/get-api-key  
  2. Enter your API key in the constant "GooglePlaceAutocompleteConnector.ApiKey". 
  3. In your application, create an AutocompleteRequest containing the parameters that you want to use for the autocomplete. 
  4. Use the request object to call POST_v1_Google_PlaceAutocomplete. The response contains predictions that match your input. 
  5. If a user of the application decides to pick one of the predictions as their location, you can use the PlaceID of the prediction to create a DetailsRequest. With this request, you can call the POST_v1_Google_PlaceDetails microflow to obtain the address fields in separate components. 

Tip: When creating requests, you can use a randomly generated session token. This will reduce the costs of the API calls. Be aware that you need to change this session token after each time you call the POST_v1_Google_PlaceDetails microflow.  

Example implementation

We don't want to give access rights to the connector module. Therefor, this implementation doesn't contain an example on how to implement the exposed microflows. If you want to check out how this connector can be used, download the example module here: https://marketplace.mendix.com/link/component/207392

Releases

Version: 1.0.0
Framework Version: 9.12.1
Release Notes: Initial release