Hello,
We are attempting to access ESRI Layers and Services using the API key in our Python application and running into issues. Currently our application uses the local user account logged into ArcGIS Pro.
The line of code we are using (after import gis from the arcgis-python-api library) to connect to the GIS is:
self.gis = GIS('home')
and we are able to use the services without much issue. However running with a local user account does not suit our purposes and we would prefer the application use an api key instead and not require log in (or a specific user) at all.
Through our conversations with ESRI their was for
1. Our organization admin to
- create an api key
- add our organization layers to the key
- save the api key, client secret, and client id
2. Use the api key, client secret, client id, and organization URL to make the gis connection with this line:
self.gis = GIS("https://{our_org}.maps.arcgis.com/", client_id=client_id, client_secret=client_secret)
However this does not seem to work and we get this error when we try to use the API Key when we try to access the layers.
Exception: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)
We need to be able to do the following operations in the python application without a specific user account:
Query Layers from ESRI
Query Layers from {our_org}
Geocode/Reverse Geocode
Create a drive time polygon buffer a point (requires network analyst which the api key account has)
Create a mile radius buffer around a point
Calculate overlap percentages with polygons against the query layers
Does anyone have any experience doing this?
Thanks,
Peter
Have you shared the layers to an ArcGIS Online group the key app is also a member of?
The org layers are owned by the user account that created the API Key and anyone in the org can view them.