TransWikia.com

Route an HTTP request through a Python function (on the way to/from AGOL)

Geographic Information Systems Asked on August 10, 2020

In an external system, I plan to invoke an HTTP GET request.

I would like the HTTP GET request to be routed through a Python function on it’s way to/from AGOL.


Steps:

  1. Invoke the HTTP GET request from the external system.
  2. A Python function would process the HTTP GET request, and it would send a subsequent HTTP GET request to AGOL.
  3. AGOL would receive the request and return a response to the Python function.
  4. The Python function would process the AGOL response and send a response of its own to the external system.

Question:

Is there a mechanism in AGOL (or ArcGIS Hub) where the Python function could be stored/accessed via HTTP?

One Answer

Neither ArcGIS Online nor ArcGIS hub allow you to run Python code in this fashion. The only thing close to this would be either:

  • A GP Service, which has a RESTful endpoint that you can hit. This would execute your Python code. Note this is only available from an on premise ArcGIS Server. You cannot publish GP Services to AGOL
  • Possibly ArcGIS Notebooks, but I don’t think they’ll do what you want where YOU call them. Notebooks has the new ability to schedule a task. That is, the Python code would run at a given interval; not when something makes an HTTP request.

I’d look into Azure Functions. There is a slight learning curve but you can write and publish Python code that responds to an HTTPTrigger. IE it creates a URL that functions as a RESTful API that you trigger by sending HTTP requests too. I’ve found the Azure pricing very reasonable. If you want to get a sense of what’s involved, you can browse the code I wrote that works on a TimerTrigger (ie run at a given interval). This code makes requests to AGOL and based on the response sends an email. From my understanding of your project, not terribly different.

Answered by KHibma on August 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP