Popup contents based on return from external api?

951
3
09-12-2019 09:41 AM
EvanThoms
Occasional Contributor II

Is there a way, ideally in AGOL, to get a popup to show the results from a query to an external api? That is, unrelated to any layer in the map, you click on a map and have the lat and long values sent as parameters in a url (presuming here that a base url can be stored in some kind of configuration for the popup) which then returns content to be displayed in the popup window?

Tags (1)
0 Kudos
3 Replies
NeilCurriVC
New Contributor III

You could populate the attribute table of feature layer whose feature is being clicked on to trigger the popup with lat and long coords, then use Arcade to insert those values into a query string. Or you could simply add the query text with the coordinates of each feature into a new attribute column.

As for getting the info back and parsing it into a pop-up window I found a similar question posed here. The answer that one I believe the asker ultimately used I don't think is possible in ArcGIS Online. There were other suggestions to use Arcade or JavaScript to display info from an external API, and those seem more doable to me, but I don't know where to start from there. 

In my case, looking to grab attribute info from a JSON with a simple query based on a unique ID for each feature, (http://someurl.com/file.json?unique_id=999) and populate my pop-up with that information - if that's possible. Is that something like what you're trying to accomplish? 

0 Kudos
EvanThoms
Occasional Contributor II

Neil,

Thanks, yes, those are similar scenarios. I was starting to think of something like what you suggest. I was imagining a giant dummy polygon that covered my area so that I could have a hosted feature layer just to have access to a popup, but that's as far as got. Might look at this more in a few days.

0 Kudos
Oliver_Sandoval_e
New Contributor III

Hi Evan,

Were you able to implement this? Thank you for your time!

0 Kudos