|
POST
|
Unfortunately, not with the ArcGIS API for Python. When trying to do so, a browser is opened asking for credentials. https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/
... View more
10-04-2021
08:50 AM
|
0
|
1
|
4515
|
|
POST
|
Hi @CarlVricella, After you have stopped all ArcGIS Server services accessing data from your Enterprise Geodatabase, and disconnecting all users, I would query the following table to ensure they are empty: select * from dbo.SDE_process_information select * from dbo.SDE_table_locks select * from dbo.SDE_layer_locks select * from dbo.SDE_object_locks select * from dbo.SDE_state_locks If any are populated, you may have an orphaned connection/lock that needs to be addressed.
... View more
10-04-2021
08:34 AM
|
0
|
1
|
6442
|
|
POST
|
Correct, the expiration of the application owner's password should not interfere.
... View more
10-04-2021
08:31 AM
|
0
|
1
|
4537
|
|
POST
|
Hi @CarlVricella, You can use an Oauth2.0 Application to generate your token: 1. In ArcGIS Online go to Content > New Item > Application 2. Other application > Next 3. Specify a Title and Tags and click Save JakeSkinner_0-1633360918484.png 4. In the Items Details of the new application, click the Settings tab 5. Scroll down and click Registered Info 6. Copy the App ID and App Secret JakeSkinner_1-1633360994501.png 7. You can then use this to generate a token: import requests, json
# Generate Token
try:
params = {
'client_id': clientId,
'client_secret': clientSecret,
'grant_type': "client_credentials",
}
request = requests.get('https://www.arcgis.com/sharing/oauth2/token', params=params)
response = request.json()
token = response["access_token"]
except Exception as e:
errorLog("Error generating token", e)
... View more
10-04-2021
08:26 AM
|
2
|
3
|
4542
|
|
POST
|
Hi @LucileFayolle, If you export your model to a python script, you can leverage the ArcGIS API for Python. With this module you can use the truncate method, which is much faster than Delete Rows. Ex: import arcpy
from arcgis import GIS
# Variables
portal = 'https://portal.esri.com/portal' # Portal URL
username = 'portaladmin' # portal username
password = '********' # portal username password
fsItemId = '7b51dcf43c3847ecabf850c607bca967' # item id of hosted feature service
# Sign Into Portal
gis = GIS(portal, username, password, verify=False)
# Truncate Hosted Feature Service
hostedFlyr = gis.content.get(fsItemId)
fLyr = hostedFlyr.layers[0]
fLyr.manager.truncate()
... View more
10-04-2021
07:45 AM
|
0
|
0
|
1675
|
|
POST
|
Yes, there is an Environments setting to do this: JakeSkinner_0-1633345186738.png
... View more
10-04-2021
03:59 AM
|
0
|
0
|
2393
|
|
POST
|
Hi @suryakant_cssl, If you have a built-in or active directory account for Portal, you can use the following tool to copy services: https://community.esri.com/t5/arcgis-enterprise-documents/copy-content-between-portals/ta-p/920460
... View more
10-01-2021
06:22 AM
|
0
|
1
|
3419
|
|
POST
|
@Anonymous User instead of downloading the feature service as a File Geodatabase, you can use ArcGIS Pro's Append tool and append the feature service directly to your Enterprise Geodatabase feature class.
... View more
10-01-2021
03:40 AM
|
2
|
2
|
2415
|
|
DOC
|
@KevinMacLeodCAI you would have 2 options: 1. Overwrite the hosted feature service 2. Use the script above. All you have to do is update the 4 variables: JakeSkinner_0-1632932478749.png
... View more
09-29-2021
09:21 AM
|
0
|
0
|
62986
|
|
DOC
|
@KevinMacLeodCAI no, I don't believe tasks will work. I'm not an expert, but from what I've seen and know, tasks simply provides a tutorial of the steps. It does not execute them, or create a script. Here is some further documentation on tasks: https://pro.arcgis.com/en/pro-app/latest/help/tasks/create-a-simple-task.htm
... View more
09-29-2021
08:53 AM
|
0
|
0
|
62998
|
|
POST
|
@LindaSlattery here is the updated code that will first perform a truncate of the hosted table, and then update the table with all records. import requests, json, arcpy
from arcgis import GIS
# Variables
username = "jskinner_CountySandbox" # AGOL Username
password = "********" # AGOL Password
itemID = 'f214df9b8f5440149a20ccd5d452a95e' # AGOL Table Item ID
dataURL = 'https://eagle-i.doe.gov/api/outagesummary/countymax24hoursummary?state=OH&eiApiKey='
# Disable warnings
requests.packages.urllib3.disable_warnings()
# Connect to AGOL
print("Connecting to AGOL")
gis = GIS('https://www.arcgis.com', username, password)
# Get Table
print("Get Hosted Table")
fLayer = gis.content.get(itemID)
editTable = fLayer.tables[0]
# Truncate Table
print("Truncate table")
editTable.manager.truncate()
# Get Data
print("Retrieving Data")
r = requests.get(dataURL, verify=False)
response = json.loads(r.content)
data = response['data']
# Create Dictionary of attributes and update table
print("Updating hosted table")
for attr in data:
addFeatures = {
"attributes" : {
"currentOutage" : attr['currentOutage'],
"currentOutageRunStartTime" : attr['currentOutageRunStartTime'],
"maxOutage1" : attr['maxOutage1'],
"maxOutage1RunStartTime": attr['maxOutage1RunStartTime'],
"maxOutage24": attr['maxOutage24'],
"maxOutage24RunStartTime": attr['maxOutage24RunStartTime'],
"totalCustomers": attr['totalCustomers'],
"currentOutageHasOverrideattr":attr['currentOutageHasOverrideData'],
"maxOutage24HasOverrideData": attr['maxOutage24HasOverrideData'],
"maxOutage1HasOverrideData": attr['maxOutage1HasOverrideData'],
"countyName": attr['countyName'],
"stateId": attr['stateId'],
"stateName": attr['stateName'],
"countyFIPSCode": attr['countyFIPSCode']
}
}
# Update Table
editTable.edit_features(adds=[addFeatures])
print("Finished")
... View more
09-17-2021
01:49 PM
|
0
|
0
|
11164
|
|
POST
|
@LindaSlattery you should not need the params = {'f':'pjson'}. The issue appears to be the type of field for totalCustomers. This is set to Small Integer: JakeSkinner_0-1631634882192.png This data type is limited to only a small range of values. I would recommend converting all fields from Small Integer to Long Integer, then republish the feature service.
... View more
09-14-2021
08:55 AM
|
0
|
0
|
3695
|
|
POST
|
@LindaSlattery I found the issue. The request needs to be a get rather than a post. JakeSkinner_0-1631626165763.png Here is the updated code: import requests, json
from arcgis import GIS
# Variables
username = "jskinner_CountySandbox" # AGOL Username
password = "********" # AGOL Password
itemID = 'f214df9b8f5440149a20ccd5d452a95e' # AGOL Table Item ID
dataURL = 'https://eagle-i.doe.gov/api/outagesummary/countymax24hoursummary?state=OH&county=Adams&eiApiKey=0000...'
# Disable warnings
requests.packages.urllib3.disable_warnings()
# Connect to AGOL
gis = GIS('https://www.arcgis.com', username, password)
# Get Table
fLayer = gis.content.get(itemID)
editTable = fLayer.tables[0]
# Get Data
r = requests.get(dataURL, data = params, verify=False)
response = json.loads(r.content)
data = response['data']
print(data)
# Create Dictionary of attributes
addFeatures = {
"attributes" : {
"currentOutage" : data[0]['currentOutage'],
"currentOutageRunStartTime" : data[0]['currentOutageRunStartTime'],
"maxOutage1" : data[0]['maxOutage1'],
"maxOutage1RunStartTime": data[0]['maxOutage1RunStartTime'],
"maxOutage24": data[0]['maxOutage24'],
"maxOutage24RunStartTime": data[0]['maxOutage24RunStartTime'],
"totalCustomers": data[0]['totalCustomers'],
"currentOutageHasOverrideData":data[0]['currentOutageHasOverrideData'],
"maxOutage24HasOverrideData": data[0]['maxOutage24HasOverrideData'],
"maxOutage1HasOverrideData": data[0]['maxOutage1HasOverrideData'],
"countyName": data[0]['countyName'],
"stateId": data[0]['stateId'],
"stateName": data[0]['stateName'],
"countyFIPSCode": data[0]['countyFIPSCode']
}
}
# Update Table
editTable.edit_features(adds=[addFeatures])
print("Finished")
... View more
09-14-2021
06:29 AM
|
0
|
0
|
3703
|
|
POST
|
@LindaSlattery did you update the dataURL variable with the correct URL including the token?
... View more
09-13-2021
10:36 AM
|
0
|
0
|
4196
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-08-2026 12:27 PM | |
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|