Scripting tasks using the GeoEvent Admin API

10-19-2016 06:09 AM
Occasional Contributor
2 7 1,120

While working on a project that required the use of thegeoevent extension‌ to send emails based on updates to a hosted feature service, we found that we needed to quickly stop the email output connectors before performing a server restart. To do this you can go through the GeoEvent Manager and manually stop the email output connectors, but this assumes that your GeoEvent admin will always be available when a server restart is needed. Also, many times server maintenance is performed late at night while staff are usually not around. Fortunately, there is a way to script the process of stopping and starting your GeoEvent input and output connectors.  

The attached zip file contains a sample script that will stop GeoEvent output connectors whose Name values are contained within a python list. This script requires that you have downloaded and installed the latest ArcREST python site-package which can be accessed on GitHub. The script has been developed to start or stop GeoEvent output connectors but can easily be modified to perform the same actions on input connectors. To get started with the sample script, please do the following:

  1. Download and unzip the attached file
  2. Open the in your preferred python IDE application
  3. Locate the Input parameters comment and review the input parameter variables:
    1. Update the server variable with your GeoEvent host server name (e.g.
    2. Update the username variable with your GeoEvent admin username
    3. Update the password variable with your GeoEvent password
    4. For runType, enter either stop or start depending on what action you want to perform on the output connectors

The outputLst variable stores each output connectors Name value within a python list. The script will loop through the list of Name values and perform either the start or stop action on that specific output connector. First you need to access the Name parameter values, which are in a GUID format, by doing the following:

  1. Open a web browser and log into the GeoEvent Admin API using your GeoEvent admin credentials (e.g.
    1. Follow the directions to acquire a security token to access the GeoEvent Admin API
  2. Click on the Outputs link located on the top row of menu items
  3. In the list of Outputs, click on an output that will need to be started or stopped
  4. Copy the Name parameter value and paste it into the outputLst (be sure to put quotes around the Name string and separate with commas if adding more than one Name value)
  5. Perform steps 3 and 4 for each applicable output, when complete the outputLst should look similar to the one below
  6. Save your edits when you have finished

The script is now ready to run against your GeoEvent Admin API and should stop or start the output connectors you have stored in the python list. You can schedule this script to run on a regular basis or import the arcpy module and create a GP tool. 

I hope this helps GeoEvent users with their administrative tasks.

New Contributor II


First off, thanks for sharing!  I think, once I get this working, that it will be greatly beneficial to my workflow.  Currently, I'm having an issue that any time the GeoEvent Service stops then starts again, all the 'GeoEvent Services' in Manager fail to restart on their own, if they are performing a Field Encricher (Feature Service) process.

My question to you is would you have any suggestions on authenticating the token for the Admin API from the Python script?  I am able to authenticate just fine with a web browser, but currently, I get the following information from the script: output

I am trying to run the script from the server that GeoEvent is running on.  I tried the server name, servername.domain, localhost and always with the 403 error. 

I'm hoping I am missing something simple.

Occasional Contributor

Hi Marshall,

Sorry for not responding sooner. My first thought is that the 403 error is related to the SSL certificate used by the host ArcGIS Server. Is the host AGS still using the self-signed certificate? If so, have you imported the self-signed certificate into the Trusted Root store on the AGS host server? 



Occasional Contributor

Hi Andy

I am having the same issue as Marshall with the 403 errors. Can you please elaborate with what is involved with importing the self-signed cert into the Trusted root store.



Occasional Contributor

Has there been any update on this issue?  I am having a similar problem.  I have hosted feature service in AGOL being updated by Geoevent.  The Update a Feature Service output occasionally errors and stops writing.  If I stop and start the service everything appears to function normally.  I would like to script a start and stop weekly. Andy Ommen

Esri Regular Contributor

Eric Ironside‌ posted a follow-on to Andy Ommen‌'s blog (above) ... and included updates to Andy's code. Check out:

Esri Contributor

Hey Everyone,

In case you don't want to read too deeply into my other post, here's the secret to get rid of the 403 error (you have to set the referrer URL on the security handler prior to using it):

# GeoEvent admin URL
geeUrl = 'https://{}:{}/geoevent/admin'.format(srv, prt)
# Get GeoEvent token to access admin API
sh = AGSTokenSecurityHandler(username=usr,

# need to set the referrer to generate token correctly

sh.referer_url = geeUrl 


Eric I.

Occasional Contributor

Thank you.  That did the trick.



About the Author
Started at Esri on the DNC production team using PLTS tools to produce DNC digital chart products. Moved to the Esri Nautical product development team as a solution engineer. Now I'm a technical analyst in the Boston RO supporting regional customers.