I'd like to test all of my map services to see if the data source was copied to the server of if it's referenced. I haven't found the property in the python API just yet. Does anyone know where to find such a thing?
If you have referenced data in a service, then I assume you have ArcGIS Server so if you were to open Manager, all SOC based services have a Service Workspaces button:
From here, you can see the referenced, replaced, and copied data sets:
If you monitor the HTTP traffic, the request goes to the manifest.xml of the service:
https://<server>.<domain>.com:6443/arcgis/admin/services/<service>.MapServer/iteminfo/manifest/manifest.json?f=json&token=<token>
This returns JSON that can be parsed for the information you need:
Ex.
<SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"databases"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"byReference"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"onServerWorkspaceFactoryProgID"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"esriDataSourcesGDB.FileGDBWorkspaceFactory.1"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"onServerConnectionString"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"DATABASE=C:\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\S1.MapServer\\extracted\\v101\\pgsde.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"onPremiseConnectionString"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"DATABASE=C:\\arcgisserver_old\\directories\\arcgissystem\\arcgisinput\\S1.MapServer\\extracted\\v101\\pgsde.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"onServerName"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"pgsde.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"onPremisePath"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"datasets"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"onServerName"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"BR"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"resources"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"onPremisePath"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"C:\\arcgisserver_old\\directories\\arcgissystem\\arcgisinput\\S1.MapServer\\extracted\\v101\\S1.mxd"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"clientName"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"<client>"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"serverPath"</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"C:\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\S1.MapServer\\extracted\\v101\\S1.msd"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The sample above is from a single data source in a referenced geodatabase.
Much thanks! That'll give me a big head start when I get time to jump into this!
Kev
Thanks. So what if I have a service that has some data copied to the server, and some data reference to sde that's registered in the datastore? I'd like to be able to get copied/referenced per layer in the service. Any idea on that?
Hi Kevin,
Services that are copied will be placed in the Hosted folder within ArcGIS Server, since they are hosted feature services. You can query to see all the services in this folder:
<SPAN class="keyword token">from</SPAN> arcgis <SPAN class="keyword token">import</SPAN> GIS gis <SPAN class="operator token">=</SPAN> GIS<SPAN class="punctuation token">(</SPAN>url<SPAN class="operator token">=</SPAN><SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fportal.domain.com%2Fportal" target="_blank">https://portal.domain.com/portal</A><SPAN>"</SPAN></SPAN><SPAN class="punctuation token">,</SPAN> username<SPAN class="operator token">=</SPAN><SPAN class="string token">'admin'</SPAN><SPAN class="punctuation token">,</SPAN> password<SPAN class="operator token">=</SPAN><SPAN class="string token">'gis12345'</SPAN><SPAN class="punctuation token">,</SPAN> verify_cert<SPAN class="operator token">=</SPAN><SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">)</SPAN> gis_servers <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>admin<SPAN class="punctuation token">.</SPAN>servers<SPAN class="punctuation token">.</SPAN>list<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> server1 <SPAN class="operator token">=</SPAN> gis_servers<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>server1<SPAN class="punctuation token">.</SPAN>services<SPAN class="punctuation token">.</SPAN>list<SPAN class="punctuation token">(</SPAN>folder<SPAN class="operator token">=</SPAN><SPAN class="string token">'Hosted'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.