Currently there is no any API to access MyMaps programmatically.

I can see a feature request for this in the public issue tracker:

https://issuetracker.google.com/issues/35820262

It looks like Google is evaluating the feasibility to implement the API, however, no timeline provided at the moment.

Please star this feature request to express your interest and receive further updates.

UPDATE

As of April 2018 it looks like Google decided do not implement the API for Google MyMaps and marked the aforementioned feature request as Infeasible.

Answer from xomena on Stack Overflow
🌐
Google
developers.google.com › google maps platform › web › maps javascript api › overview
Overview | Maps JavaScript API | Google for Developers
Get started with the Google Maps JavaScript API. View a simple example, learn the concepts, and create custom maps for your site.
🌐
Google
developers.google.com › google maps platform › web › maps javascript api
Google Maps Platform Documentation | Maps JavaScript API | Google for Developers
Follow the Google Maps Platform getting started guide to create an account, generate an API key, and start building. ... Learn how to load the Maps JavaScript API, and add a map with a marker to your web app.
🌐
Google
developers.google.com › google maps platform › web › maps javascript api › set up the maps javascript api
Set up the Maps JavaScript API | Google for Developers
To create an API key, navigate ... be done via the console or Cloud SDK by setting application and API restrictions. Finally, include the API key in every Maps JavaScript API request.\n"]]...
🌐
W3Schools
w3schools.com › graphics › google_maps_intro.asp
Google API Tutorial
An API is a set of methods and tools that can be used for building software applications. This example creates a Google Map in HTML: <!DOCTYPE html> <html> <body> <h1>My First Google Map</h1> <div id="googleMap" style="width:100%;height:400...
🌐
Google
developers.google.com › google maps platform › web › maps javascript api › code samples
Code Samples | Maps JavaScript API | Google for Developers
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-12-17 UTC."],[],["This document provides a comprehensive collection of sample applications for the Maps JavaScript API.
🌐
Google Support
support.google.com › code › answer › 67818
Can I use the Maps JavaScript API with my map module? - Google Developers Help
Can I use the Maps JavaScript API with my map module? Yes, you can call the getMap() API method to get the native maps object which you can then use to call the Maps API methods. However, in GME's current implementation, some usage of the Maps API methods will break the default event handling ...
🌐
React Map GL
visgl.github.io › interacting with the google maps javascript api
Interacting with the Google Maps JavaScript API | React Google Maps
The Maps JavaScript API has a lot of additional libraries for things like geocoding, routing, the Places API, Street View, and a lot more. These libraries are not loaded by default, which is why this module provides a hook useMapsLibrary() to handle dynamic loading of those libraries.
Find elsewhere
🌐
Medium
medium.com › @ben.j.marum › google-maps-api-in-javascript-672543d62e9d
Google Maps API in JavaScript. Two years ago I tried and failed to… | by Ben M | Medium
May 24, 2023 - The final thing to make sure of is that there is an html div eleemnt with an Id of map in our HTML. The map initialization function is looking for this element with the query selector getElementById(‘map’) and the maps API throws an error if you change this query selector. The google map will bind to this div with the id of map.
🌐
Apidog
apidog.com › blog › how-to-integrate-google-http-apidog-com-blog-how-to-integrate-google-maps-api-maps-api
How to Integrate Google Maps API: A Step-by-Step Guide
July 31, 2025 - Copy the API key and keep it safe, ... into your web page, you will need to include the Maps JavaScript API script in your HTML file and create a <div> element with an ID to hold the map....
🌐
Google
developers.google.com › google maps platform › web › maps javascript api › simple map
Simple Map | Maps JavaScript API | Google for Developers
<html> <head> <title>Simple Map</title> <link rel="stylesheet" type="text/css" href="./style.css" /> <script type="module" src="./index.js"></script> </head> <body> <div id="map"></div> <!-- prettier-ignore --> <script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once.
🌐
MichaelMinn
michaelminn.net › tutorials › google-maps-api
Introduction to JavaScript and the Google Maps API
The first <script> element has a src attribute that tells it to bring in the Google Maps API JavaScript library.
Top answer
1 of 3
193

TL;DR

Use Function.prototype as a noop callback to quickly get rid of the error message.

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=Function.prototype

Full Explanation

According to the Google Maps API documentation, the callback parameter has been required for a very long time. In practice, however, Google has only recently (within the past few days) begun enforcing this requirement.

While it doesn't seem to break anything, it now shows an ugly error message in the console...

Loading the Google Maps JavaScript API without a callback is not supported.

How can I fix it?

The short answer is to specify a callback value. Set the name of the JavaScript function that you would like to trigger once the external API library has finished loading.

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=FUNCTION_NAME

Be warned, you must specify a real function name! Otherwise you'll trigger an "is not a function" error message, and simply be trading one error message for another.

But I don't have/need a callback function!

If you don't actually have a callback function to run immediately after the library loads, you can use Function.prototype as a noop stand-in.

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=Function.prototype

The Function.prototype method is native to JavaScript, and does absolutely nothing... It's exactly what you need in a situation like this!

For more information about Function.prototype, see this unrelated SO thread...

2 of 3
7

I actually created a noop function so I could keep track of when it was called.

function gmNoop() { console.log('GMap Callback') }

Then added it to my Google map API resource request.

https://maps.googleapis.com/maps/api/js?key='.GOOGLEMAPSKEY.'&callback=gmNoop

The reason I needed this was because my application calls initMap() after other prerequisites. Calling initMap() prior to these other resources would load a map without markers.

Top answer
1 of 1
4

Maps Javascript API is a CLIENT-SIDE Service

The reason why you were having a hard time running the Maps Javascript on the server-side using node is because it was not made to be used that way. Although the Maps Javascript API includes Directions Service, it does not mean that you can use it server-side.

Please do note that it was called client-side service because it should be used with a visualization of the data. In this case, loading a map in the browser.

So what should you use then because you want to run the Directions API on the server-side?

Use the Standalone Directions API Web Service

documentation specifically says this:

The Directions API is a web service that uses an HTTP request to return JSON or XML-formatted directions between locations. Directions is available in several forms:

  • as a standalone API
  • as part of the client-side Maps JavaScript API
  • for server-side use as part of the Client Libraries for Google Maps Web Services

To do this with node, you can use axios by requiring it on your javascript code. There's a code sample from the Directions API web service documentation but I made you a modified one to suit your needs. Especially in fetching steps, legs and overview_polyline.

Here's a code sample using the sample request you provided on your question:

var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://maps.googleapis.com/maps/api/directions/json?origin=Geneva&destination=Basel&mode=%20transit&key=API_KEY',
  headers: { }
};

axios(config)
.then(function (response) {
  // This is the JSON object result for the directions request
  const result = response.data;
  // Logging the `legs` array
  console.log(result.routes[0].legs);
  // Logging the `steps` array
  console.log(result.routes[0].legs[0].steps);
  // Logging the `overview_polyline`
  console.log(result.routes[0].overview_polyline)
})
.catch(function (error) {
  console.log(error);
}); 

You just have to run this code on your terminal after setting up the node environment:

node index.js

And this will log the results you wanted on the console.

p.s. you can also use the NodeJs client library the MrUpsidown provided on the comment of your question: https://github.com/googlemaps/google-maps-services-js

Hope this helps!

🌐
Google
developers.google.com › google maps platform › web › maps javascript api › google maps javascript api v3 reference
Google Maps JavaScript API v3 Reference | Google for Developers
Constants: DIRECTIONS_ROUTE, DISTANCE_MATRIX, ELEVATION_ALONG_PATH, ELEVATION_LOCATIONS, FLEET_ENGINE_GET_DELIVERY_VEHICLE, FLEET_ENGINE_GET_TRIP, FLEET_ENGINE_GET_VEHICLE, FLEET_ENGINE_LIST_DELIVERY_VEHICLES, FLEET_ENGINE_LIST_TASKS, FLEET_ENGINE_LIST_VEHICLES, FLEET_ENGINE_SEARCH_TASKS, GEOCODER_GEOCODE, MAPS_MAX_ZOOM, PLACES_AUTOCOMPLETE, PLACES_DETAILS, PLACES_FIND_PLACE_FROM_PHONE_NUMBER, PLACES_FIND_PLACE_FROM_QUERY, PLACES_GATEWAY, PLACES_GET_PLACE, PLACES_LOCAL_CONTEXT_SEARCH, PLACES_NEARBY_SEARCH, PLACES_SEARCH_TEXT, STREETVIEW_GET_PANORAMA
🌐
npm
npmjs.com › package › @googlemaps › js-api-loader
@googlemaps/js-api-loader - npm
Wrapper for the loading of Google Maps JavaScript API script in the browser. Latest version: 2.0.2, last published: 2 months ago. Start using @googlemaps/js-api-loader in your project by running `npm i @googlemaps/js-api-loader`. There are 398 ...
      » npm install @googlemaps/js-api-loader
    
Published   Oct 29, 2025
Version   2.0.2
🌐
Google Maps Platform
mapsplatform.google.com › resources › blog › loading-google-maps-platform-javascript-modern-web-applications
Blog: Loading Google Maps Platform JavaScript in Modern Web Applications – Google Maps Platform
The first library, @googlemaps/js-api-loader, dynamically loads the Maps JavaScript API and wraps the process in a Promise. This means you can now import the js-api-loader and load the Maps JS API via JavaScript rather than HTML. The loader also supports all of the options for loading the API, such as version, libraries, and apiKey, passed in as an options object.
🌐
Medium
medium.com › geekculture › a-starter-guide-to-google-maps-api-a0596c3fa084
A Starter Guide to Google Maps API | by Erin Sellers | Geek Culture | Medium
June 23, 2021 - The documentation for the Maps JS API directs you to @googlemaps/js-api-loader to get started. I’m sure this one is great! But I‘m working with React for my front-end so the documentation was a little clunky and there are other libraries that have made use of React Hooks for working with the API.