Search code examples
sessionbing-mapscredentialsgeocode

Bing maps geocode, use session key with search manager class?


I need to use the session key with my geocode requests to limit my billable transactions. The search manager class takes the map as an argument but I see no way to set the session key. Cursory investigation with Charles seems to indicate it doesn't use the session key even after calling getCredentials on its own.

If this can't be done readily it would seem like a glaring oversight.


Solution

  • The Search, AutoSuggest and Direction modules all automatically use session keys when you pass a map in when loading the manager of that module. No need to get the session key yourself. You only really need to manually get the sessions key if you were to directly connect to the REST services which.

    Depending on your application needs, directly accessing the REST services may be useful. Here are a couple of examples of when you would want to access the REST services directly:

    • You only need the raw data.
    • You want 100% full control over rendering of the results.
    • You want to access one of the services that are not exposed as a module such as the elevation service.