After I create a configured app in AGOL, can I download the source code?

2784
7
Jump to solution
09-02-2016 02:13 PM
RoyceSimpson
Occasional Contributor III

I've created a configured mapping app in AGOL.  Can I then download the source files for hosting locally or do I need to download the app first prior to any configuring online?

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

Royce Simpson‌ 


As Derek Law‌ pointed out you can download the template apps and set them up on your web server. It sounds like you already have this part setup and working correct? 

Now it sounds like you want to take the configuration settings you've defined in ArcGIS Online and apply them to your downloaded app. The simplest way to do this is to copy the item id for the Basic Viewer app you configured in Online and paste it into the appid field in the Viewer/config/defaults.js file in your locally hosted copy of the template. 

Alternatively you can just use the appid as a url param in your locally hosted version. So your app url would look something like this: 

http://localhost/Viewer/index.html?appid=718dd403ae7349c285830ac4de9c677b

Once you do this the locally hosted version will read in the app values from the configured online version.

Here are some additional background details on how the templates work - not really important but thought I'd include just in case anyone is interested. There is only one copy of all the configurable app templates hosted in ArcGIS Online. That app has some default values setup and the source code you download is an exact copy of that one hosted app. When you create a new application in ArcGIS Online based on one of the templates a copy of the app source code isn't created we just create an item in ArcGIS Online that stores the values you've specified in the config panel. The template source code knows how to read this online item - which it access via the appid. The item just contains the modifications you've specified in the default panel. Here's an example showing what the info stored in the appid looks like. In this example I've disabled search and modified the theme colors. 

If your configured app item is public you can see the values you've set by replacing the id in this url with your own id. 

http://www.arcgis.com/sharing/rest/content/items/74791ca2d51345de847dddc52adb4311/data?f=json 

View solution in original post

7 Replies
DerekLaw
Esri Esteemed Contributor

Hi Royce,

Yes, you can download the source code for your ArcGIS Online configurable apps and host them on your own web server. Please see this help topic,

Download apps—ArcGIS Online Help | ArcGIS 

Hope this helps,

RoyceSimpson
Occasional Contributor III

Thanks Derek.  I did look at that page but it doesn't seem to address what I'm trying to do, but perhaps I'm not reading the page right too.  Everything on that page refers to downloading the configurable app, getting it setup locally and then configuring it.  

I've already created and configured and app that is being hosted in AGOL.  I'd like to download that source, with all the configurations I've already made to it and deploy it locally.

0 Kudos
DerekLaw
Esri Esteemed Contributor

Hi Royce,

Actually, you can do both workflows you describe:

1. Download a configurable app's source code, then make additional changes/customizations and host on your own web server;

2. Create and configure an app in ArcGIS Online, then download its source code to host on your own web server.

Based on what you want,

> I've already created and configured and app that is being hosted in AGOL.  I'd like to download that source, with all the configurations I've already made to it and deploy it locally.

I suggest you follow the steps under the section titled "Download an app starting from My Content".

EDIT: Please see more detailed steps in khutchins-esristaff‌'s post below.

Hope this helps,

RebeccaStrauch__GISP
MVP Emeritus

But keep in mind that if the app is a Web AppBuilder app, the AGOL version maybe be out of sync, feature-wise, since AGOL gets updates and new features first, WAB developer edition second, and Portal last.  

RoyceSimpson
Occasional Contributor III

I'm still not following how to configure an app in AGOL then, after having configured it, download the configured app for hosting on my local server. 

I do see how to download apps prior to configuring them... as pointed out by Derek in the AGOL doc but that doesn't get me what I'm looking for.  My workflow is this:  I open a web map in AGOL, add a map service, configure the web map the way I'd like it then open it in a "basic map viewer" app template.  I go into the app and configure it to have the colors I want, various functionality turn on, etc...  Then would like to download that exact app/site to my local server for hosting locally.  I don't want to simply go back and download the basic viewer from github as that zip doesn't have any of the configurations that I saved in the hosted app.  I want to download the hosted, configured app.

Thanks,

-Royce

0 Kudos
KellyHutchins
Esri Frequent Contributor

Royce Simpson‌ 


As Derek Law‌ pointed out you can download the template apps and set them up on your web server. It sounds like you already have this part setup and working correct? 

Now it sounds like you want to take the configuration settings you've defined in ArcGIS Online and apply them to your downloaded app. The simplest way to do this is to copy the item id for the Basic Viewer app you configured in Online and paste it into the appid field in the Viewer/config/defaults.js file in your locally hosted copy of the template. 

Alternatively you can just use the appid as a url param in your locally hosted version. So your app url would look something like this: 

http://localhost/Viewer/index.html?appid=718dd403ae7349c285830ac4de9c677b

Once you do this the locally hosted version will read in the app values from the configured online version.

Here are some additional background details on how the templates work - not really important but thought I'd include just in case anyone is interested. There is only one copy of all the configurable app templates hosted in ArcGIS Online. That app has some default values setup and the source code you download is an exact copy of that one hosted app. When you create a new application in ArcGIS Online based on one of the templates a copy of the app source code isn't created we just create an item in ArcGIS Online that stores the values you've specified in the config panel. The template source code knows how to read this online item - which it access via the appid. The item just contains the modifications you've specified in the default panel. Here's an example showing what the info stored in the appid looks like. In this example I've disabled search and modified the theme colors. 

If your configured app item is public you can see the values you've set by replacing the id in this url with your own id. 

http://www.arcgis.com/sharing/rest/content/items/74791ca2d51345de847dddc52adb4311/data?f=json 

RoyceSimpson
Occasional Contributor III

Ah, Thanks Kelly.  That's exactly what I was trying to get at.  Problem solved.