Map without API key

5036
12
10-11-2021 01:07 PM
ScottAndersonGQ
New Contributor III

I wrote some code that creates a map and allows users to click on the map. The click takes the lat,lng (of click) and queries a government's GIS database and returns the parcel number. They can also use the default search widget and search by address, which ultimately does the same thing. 

I also added a polygon layer that outlines parcels and another polygon layer that outlines houses. 

I am NOT USING AN API KEY. I am NOT using esriConfig. 

The code works and seems fairly easy to disseminate. I just add:

<script src="https://js.arcgis.com/4.20/"></script>

And the code just works. Basemap layers and Geocoding are a part of the Pricing, although nothing is stopping my code from running. 

The Questions is: Do I still need an API key? If so, does the search widget use a Geocoding credit? Does the adding a layer or loading the basemap use a Basemap credit? 
If not, why not? (But also not complaining)

Extra Info:
To Query I use -> {featurelayerlink}/query?
geometry={lat} {lng}&...etc
To Add a Layer I use -> map.add(
new FeatureLayer({          url: featureLayerURL, ...etc    }))
To Make the map -> map = new Map({        basemap: "streets",      });
Tags (4)
0 Kudos
12 Replies
BjornSvensson
Esri Regular Contributor

Hi @ScottAndersonGQ - as for your question about "Do I need an API key?":

That depends on your account.  If you are using an ArcGIS Developer account, then yes, you need an API key. If you are using an ArcGIS Online account, then no, API key is not required.
https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/accounts/#arcgis-on...
As shown on that page, if you're using an ArcGIS Online account, then "Basemap layers" and "Geocoding (not stored)" does not consume credits.

LeandroAlmeida
New Contributor

I also came across the same situation while configuring my application to use a token-based authentication from ArcGIS Enterprise. 

If you check this codepen you can see what we mean.

There is no code to input an API key nor a token and yet the map loads without a problem.

All the basemaps from this documentation section works without authentication.

"For use without an API key
Use of these basemaps requires a valid ArcGIS Online organizational subscription or an ArcGIS Enterprise license."

 

Is it correct to assume these base maps don't need authentication of any kind to be loaded? If so, will it continue to be accessible in the future in the same manner?

0 Kudos
BjornSvensson
Esri Regular Contributor

If you have an ArcGIS Enterprise license , you can legally use the basemaps listed under "For use without an API key"  - and your application does not need to specify an API key.

@LeandroAlmeida - does this help clarify?

LeandroAlmeida
New Contributor

Thanks for the reply, Bjorn

I understand API Keys are just for ArcGIS Online and Enterprise should use token or OAuth authentication, but what I don't understand is what tells ArcGIS that I really have a license in the first place if I can go to codepen or any other site and just input a code with no reference to my enterprise account whatsoever?

  • Is it just for demonstration/testing purposes?
  • If so, why the maps accessible with the API key is not open for testing as well?
  • Does this approach without a key or token have any limits to how much the application can consume?

I'm asking all these questions because if we can just ship out a code without any API/token reference that's the way we will take it since we won't have to deal with another endpoint to handle authentication (we are using client_credentials tokens).

I just want to be certain that this approach will keep working in the future, in order to keep our site running without problems.

Just to give you a context, the website in question is only using the base map, all the other layers are being generated on the client side.

 

BjornSvensson
Esri Regular Contributor

Hi @LeandroAlmeida 
Technically there is nothing that tells ArcGIS that you indeed have an Enterprise license. It's a "paper" license. The terms are described in details in the E300 MLA - https://www.esri.com/en-us/legal/terms/product-specific-scope-of-use.   
There's no special limits for using this keyless/tokenless approach - assuming you have the license.

We don't currently have any plans to change that as far as I know.

https://developers.arcgis.com/javascript/latest/licensing/ 

NarasimhaNallamsetty
New Contributor

Hi @BjornSvensson , please help me with iOS code to setup map without API key for ArcGIS enterprise account. Please share sample code or links for iOS and Android. thank you in advance.

0 Kudos
BjornSvensson
Esri Regular Contributor

Hi @NarasimhaNallamsetty , for questions related to iOS/Android, I would recommend asking in their related communities, see https://community.esri.com/t5/arcgis-maps-sdks-for-native-apps/ct-p/arcgis-runtime-sdks

0 Kudos
Flayner
New Contributor II

Hi @BjornSvensson, I'm in the same situation as @ScottAndersonGQ  and @LeandroAlmeida, however, in the link provided in the image below there is no longer the option you mentioned. I didn't find the basemaps that can be used without using an API Key.

Flayner_0-1704723164794.png

 

We have the ArcGIS enterprise license, and I would like to know if there is still an option to use basemaps without using the API Key.

0 Kudos
BjornSvensson
Esri Regular Contributor

@Flayner - the basemap documentation is available at https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap .
In your case, you're looking for option 2, "From a basemap id" - see https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap-id 

0 Kudos