Technical Blog Post
Abstract
How to configure Google Maps API using only API Key without Client ID on IBM Maximo Asset Management v7.6.0
Body
When decide and planning to migrate to use only API Key instead of Client ID for authenticating requests Google Maps in Maximo 7.6.0 environment.
As we may know that "Client ID" (all client IDs begin with a gme- prefix) was required when using Google Maps provider in Maximo 7.6.0.
Before begin, first is Maximo 7.6.0 should already configure maps in Map Manager application to enabling maps as per in this guide
https://www.ibm.com/support/knowledgecenter/SSLKT6_7.6.0.8/com.ibm.mbs.doc/map_manager/t_config_maps.html
And already obtained the appropriate API Key from Google Maps Platform the map provider that you select.
Remember to ensure that network firewall accepts outgoing connections from client browser to Google links on port 443 used when map is loaded and displayed into client browser:
https://maps.google.com:443
https://maps.gstatic.com:443
https://fonts.googleapis.com:443
https://fonts.gstatic.com:443
https://maps.googleapis.com:443
Meanwhile, try to check from browser window console log about error/warning when the map request loaded (Checking Errors in Your Browser --> https://developers.google.com/maps/documentation/javascript/error-messages#checking-errors using Developer Tools or press F12 on your keyboard)
Actually, there are two warning regarding RetiredVersion and SensorNotRequired when using Google Maps provider in Maximo 7.6.0:
- Google Maps JavaScript API warning: RetiredVersion https://developers.google.com/maps/documentation/javascript/error-messages#retired-version
- Google Maps JavaScript API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
That warning occurred because some of the parameters are no longer required for the Maps JavaScript API and need to update with the relevant elements and parameters.
Current URL was generated every time sent authenticating requests to Google Maps:
https://maps.google.com/maps/api/js?v=3.8&sensor=true&callback=ibm.tivo…
Parameter “&v=” (API version as set in mxe.map.googleMapsAPIVersion), “&sensor=true” (no longer required, and recommend to remove), and “&client=” (to be changed to &key=)
Now, let's follow these step to fixed and to use only API Key for authenticate requests:
1. Change the property value of mxe.map.googleMapsAPIVersion on Global Properties (System Properties application) from value 3.8 (default) to value 3.38 (or as per valid versioning Map API on Google, check https://developers.google.com/maps/documentation/javascript/versions for release channels and version numbers)
2. Add/Change the value on MAPMANAGER.GMAPSLICENSE text-labeled "Google client ID" field in Map Manager application with YOUR_GOOGLE_MAPS_API_KEY.
3. The final step is to edit dojo (.js) file mxmap.js file under the following path
Windows:
<WebSphere_folder>\AppServer\profiles\ctgAppSrv01\installedApps\ctgCell01\MAXIMO.ear\maximouiweb.war\webclient\javascript\dojo-20171016-1334\layers\map\mxmap.js
Linux:
<WebSphere_folder>/AppServer/profiles/ctgAppSrv01/installedApps/ctgCell01/MAXIMO.ear/maximouiweb.war/webclient/javascript/dojo-20171016-1334/layers/map/mxmap.js
- Backup file mxmap.js (copy/rename put into your backup folder)
- Change string "&client=" to "&key="
- Remove string &sensor=true
- Save file mxmap.js
There are NO DOWN-RESTART/ADMIN-MODE required. Since there's no Database Structure or Java-class was changed.
(Info: Restarting websphere/weblogic application server is required if you plan re-build MAXIMO.ear and re-deploy to application server when applying the step above)
After finishing step above, the request parameter URL was changed, then the map displayed, and looks good.
(* Remember to clear client browser cache e.g. Mozilla FireFox or Google Chrome)
https://maps.google.com/maps/api/js?v=3.38&key=DuAne2ne-0IzaSyBT2hs-aRIt0nANg-aPReasTer&callback=ibm.tivoli.fwm.mxmap.factories.gmaps.apiLoaded
Note:
* Google Maps API version. The value must correspond with a valid Google version.
** All step above is for you to decide and plan to use only API Key for authenticating requests instead of using Client IDs.
*** Restrict the API key and Registering authorized URLs under Google Cloud Platform Console
**** The latest version of IBM Maximo 7.6.1, now clients are able to choose either using API Key or Client ID for Google Maps provider.
Related Information:
/support/pages/node/564953
/support/pages/node/300651
https://developers.google.com/maps/documentation/javascript/get-api-key
https://developers.google.com/maps/documentation/javascript/error-messages
https://developers.google.com/maps/documentation/javascript/get-api-key#registering-authorized-urls
https://support.google.com/accounts/answer/32050?co=GENIE.Platform%3DDesktop&hl=en
https://support.mozilla.org/en-US/kb/how-clear-firefox-cache
UID
ibm11128873