Use ArcGIS REST API from a backend service, scripts, api proxy, cron jobs etc..

a month ago
New Contributor

For a client I need to be able to add attributes to a feature server. I identified 2 endpoints that works except I don't understand how the authentication works from a internal system.

endpoint 1: POST /arcgis/rest/admin/services/<service>/FeatureServer/<layer>/addToDefinition

endpoint 2: POST arcgis/rest/services/<service>/FeatureServer/<layer>/updateFeatures

How can I authenticate these requests in a internal system like a cron job, script etc...?

I tryed the api key  but doesn't seem to work. 

I could just use with username and password. Store the token and refetch if expired but that doesn't seem like a best practice.

0 Kudos
1 Reply
Esri Esteemed Contributor

Hi Jort,

I recommend generating the token each time you are making a post request.  Python Ex:

import requests, json

# Generate Token
tokenURL = ''
params = {'f': 'pjson', 'username': username, 'password': password, 'referer': ''}
r =, data = params, verify=False)
response = json.loads(r.content)
token = response['token']

# Post Request