POST
|
I've received word from a Product Engineer that the popup returning different from a feature search is a known issue and will hopefully be fixed in the upcoming AGOL release. Going to close this thread.
... View more
10-23-2017
08:52 AM
|
2
|
0
|
346
|
POST
|
I have a conditional Arcade Expression in a popup. The expression renders in the map if a user clicks on the feature. However, the map is configured to allow searching on an address field. And if I type in an address and zoom to the resulting feature, the Arcade expression is blank. In the map linked below, try typing 520 E Tempe Town Lake in the search bar and selecting the autocomplete result from the layer. Notice how the third expression is blank? Close the popup and click again on the feature. The third expression is now completed using the When function. Edit: link removed Is there an issue with the Arcade logic that's employed that may be causing this? I've tried IIF, if/else if/else, etc. but all functions render empty in the popup when calling the popup on the search result.
... View more
10-20-2017
03:26 PM
|
0
|
1
|
532
|
POST
|
from arcgis import *
#declare gis
gis = GIS('portal url', 'admin user', 'admin pass')
#return list of users in portal
user = gis.users.search('', '', max_users=2000)
#specify group for method
group = gis.groups.search('title: your group title', '')
#add user list to group with specified index value since gis.groups.search returns a list
group[0].add_users(user)
#confirm users were added by calling get_members method on group with index value
group[0].get_members()
... View more
10-16-2017
11:30 AM
|
5
|
2
|
2434
|
POST
|
Per the ArcGIS REST API Item Types page, there is a Web Mapping Application type. See here: ArcGIS REST API Using that item type, when I call gis.content.search('', 'web mapping application') on a portal I can receive back JSON for items built using different templates (e.g. WebApp Builder and Storymaps). However, the JSON appears to vary between the item types (see bellow). Is there a method in the API that would allow us to more easily parse the varying data structures when we call gis.content.search('', 'web mapping application') I'm attempting to harvest both a list of all web mapping applications in a given portal and slice through their JSON to retrieve the underlying webmap ID in order to visualize 1:M relationships. Sample Storymap Data: {
"source": "sourceID",
"folderId": null,
"values": {
"title": "Title",
"subtitle": "Title",
"order": [
{
"id": 28,
"visible": false
}
],
"webmap": "authoring webmap ID",
"layout": "integrated",
"placardPosition": "",
"locationButton": true,
"colors": "#152638;#728294;#ebebeb",
"headerLinkText": "",
"headerLinkURL": "",
"logoURL": "",
"logoTarget": "URL",
"social": {
"facebook": false,
"twitter": false,
"bitly": false
},
"zoomLevel": "18",
"sourceLayer": "maptour-layer1475173714814_0",
"template": "Map Tour",
"templateCreation": "2.5.2",
"templateVersion": "2.8.0",
"firstRecordAsIntro": true
}
} Sample WebApp Builder Data {
theme: {
name: "FoldableTheme",
styles: [],
version: "2.0"
},
portalUrl: "http://tempegov.maps.arcgis.com",
appId: "",
authorizedCrossOriginDomains: [],
title: "Zoning and Overlay Districts",
subtitle: "<div class="attribute-custom-style"></div>",
keepAppState: true,
links: [],
widgetOnScreen: {},
map: {
3D: false,
2D: true,
position: {},
itemId: "84d75bd05f1d47f8a0266f8778c4498f",
mapOptions: {},
id: "map",
portalUrl: "http://tempegov.maps.arcgis.com"
},
widgetPool: {},
mobileLayout: {},
loadingPage: {
backgroundColor: "#508dca",
backgroundImage: {
visible: false
},
loadingGif: {
visible: true,
uri: "configs/loading/images/predefined_loading_1.gif",
width: 58,
height: 29
}
},
wabVersion: "2.4",
_buildInfo: {},
isWebTier: false,
httpProxy: {}
}
... View more
09-28-2017
10:46 AM
|
0
|
0
|
498
|
POST
|
Look into subtypes when designing your geodatabase. You should take a look at the feature template documentation as well. An overview of subtypes—Geodatabases | ArcGIS Desktop Manage feature templates—ArcGIS Online Help | ArcGIS
... View more
09-15-2017
04:28 PM
|
1
|
0
|
310
|
POST
|
Michael, Please see this thread: How can I change the order of popups on an ArcGIS Online Map It's from 2014 but I think that the answer remains valid. In short, the pop ups appear in the order in which each feature returns its information to the client. This has also been proposed on ArcGIS Ideas: https://community.esri.com/ideas/6548
... View more
09-14-2017
01:44 PM
|
0
|
1
|
626
|
POST
|
Joel, If you open the Developer console on your browser (in Chrome hit F12, then select Console), then run the failing Query what is the output?
... View more
09-08-2017
02:43 PM
|
0
|
3
|
861
|
POST
|
Is there a system-based reason that adding a new, non-ADFS user to our portal requires the appending of a number to the username string? So instead of jamesst, AGOL requires jamesst1, etc.
... View more
09-01-2017
11:00 AM
|
0
|
2
|
630
|
POST
|
I don't know if there's a GUI-based method for pulling the size information from multiple items, but you can do this using the Python API. The pseudo code below will output a CSV listing every Hosted Service, its itemId and the size of the item in bytes. from arcgis.gis import *
import csv
gis = GIS('Portal URL', 'admin', 'password')
hosted_layers = gis.content.search('typekeywords: "Hosted Service"', max_items=1000)
print('Hosted Service Count: ' + str(len(hosted_layers)))
fields = ['id', 'title', 'size']
with open(r'file location', 'w', newline='') as outfile:
csvfile = csv.writer(outfile)
csvfile.writerow(fields)
for layer in hosted_layers:
row = [layer.id, layer.title, layer.size]
csvfile.writerow(row)
print(outfile.name)
... View more
08-23-2017
03:25 PM
|
1
|
0
|
2140
|
POST
|
Alexis, It sounds like Windows Task Scheduler offers the functionality that you're seeking.
... View more
08-23-2017
03:05 PM
|
1
|
6
|
2219
|
POST
|
Brian, The application is working for me now. But I took a look at your network traffic a moment ago when the app was failing and it showed that there was an error when the spatial query tried to return the geometry of your police divisions map service. Again, the app appears to be functioning normally but something to keep in mind if the issue occurs again.
... View more
08-02-2017
09:31 AM
|
1
|
0
|
432
|
POST
|
Does ArcGIS Hub support having a vector tile basemap as the custom option for an open data site? If this is not currently supported, I think that it would make a great enhancement for future releases.
... View more
08-01-2017
01:27 PM
|
0
|
0
|
368
|
POST
|
Glad it helped Adam. Don't forget to mark this discussion as Answered if your question was solved.
... View more
07-31-2017
11:38 AM
|
0
|
2
|
774
|
POST
|
With admin privileges to the ArcGIS Server instance, the following script will print the service, onServerWorkspace, onServerConnectionStrings for the underlying database server, version and database as well as a list of tables/feature class objects that are referenced in the service. It'll also output a CSV listing all services and their properties but I think the print statements are what you're looking for. # Reads the following properties from services and writes them to a comma-delimited file:
# ServiceName, Folder, Type, Status, Min Instances, Max Instances, KML,
# WMS, Max Records, Cluster, Cache Directory, Jobs Directory, Output Directory
# For HTTP calls
import httplib, urllib, json
# For system tools
import sys
# For reading passwords without echoing
import getpass
import uuid
import re
regexpSERVER = re.compile("SERVER=([^;]*);")
regexpVERSION = re.compile("VERSION=([^;]*);")
regexpDATABASE = re.compile("DATABASE=([^;]*);")
def main(argv=None):
# Ask for admin/publisher user name and password
username = "username"
password = "password"
# Ask for server name & port
serverName = "servername"
serverPort = 6080
# Get the location and the name of the file to be created
resultFile = str(uuid.uuid4()) + ".csv"
# Get a token
token = getToken(username, password, serverName, serverPort)
# Get the root info
serverURL = "/arcgis/admin/services/"
# This request only needs the token and the response formatting parameter
params = urllib.urlencode({'token': token, 'f': 'json'})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
# Connect to URL and post parameters
httpConn = httplib.HTTPConnection(serverName, serverPort)
httpConn.request("POST", serverURL, params, headers)
# Read response
response = httpConn.getresponse()
if (response.status != 200):
httpConn.close()
print "Could not read folder information."
return
else:
data = response.read()
# Check that data returned is not an error object
if not assertJsonSuccess(data):
print "Error when reading server information. " + str(data)
return
else:
print "Processed server information successfully. Now processing folders..."
# Deserialize response into Python object
dataObj = json.loads(data)
httpConn.close()
#Store the Folders in a list to loop on
folders = dataObj["folders"]
#Remove the System and Utilities folders
folders.remove("System")
folders.remove("Utilities")
#Add an entry for the root folder
folders.append("")
#Create the summary file of services
serviceResultFile = open(resultFile,'w')
serviceResultFile.write("ServiceName,Folder,Type,Status,Min Instances,Max Instances,FeatureService,kml,wms,Max Records,Cluster,Cache Directory,Jobs Directory,Output Directory" + "\n")
#Loop on the found folders and discover the services and write the service information
for folder in folders:
# Determine if the loop is working on the root folder or not
if folder != "":
folder += "/"
# Build the URL for the current folder
folderURL = "/arcgis/admin/services/" + folder
params = urllib.urlencode({'token': token, 'f': 'json'})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
# Connect to URL and post parameters
httpConn = httplib.HTTPConnection(serverName, serverPort)
httpConn.request("POST", folderURL, params, headers)
# Read response
response = httpConn.getresponse()
if (response.status != 200):
httpConn.close()
print "Could not read folder information."
return
else:
data = response.read()
# Check that data returned is not an error object
if not assertJsonSuccess(data):
print "Error when reading folder information. " + str(data)
else:
print "Processed folder information successfully. Now processing services..."
# Deserialize response into Python object
dataObj = json.loads(data)
httpConn.close()
# Loop through each service in the folder
for item in dataObj['services']:
if item["type"] == "GeometryServer":# and folder == "":
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
# Build the Service URL to test the running status
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
servStatusResponse = httpConn.getresponse()
# Obtain the data from the response
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["clusterName"]) + "," + "NA" + "," + "NA" + "," + "NA" +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "SearchServer":# and folder == "":
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["clusterName"]) + "," + "NA" + "," + str(jsonOBJ["properties"]["jobsDirectory"]) + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "ImageServer":
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
# Build the Service URL to test the running status
if folder:
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Extract the WMS properties from the response
wmsProps = [imageWMS for imageWMS in jsonOBJ["extensions"] if imageWMS["typeName"] == 'WMSServer']#.items()[0][1] == 'WMSServer']
if len(wmsProps) > 0:
wmsStatus = str(wmsProps[0]["enabled"])
else:
wmsStatus = "NA"
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + wmsStatus +"," + "NA" + "," + str(jsonOBJ["clusterName"]) + "," + str(jsonOBJ["properties"]["cacheDir"]) + "," + "NA," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "GlobeServer":
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
#Build the Service URL to test the running status
if folder:
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["properties"]["maxRecordCount"]) + "," + str(jsonOBJ["clusterName"]) + "," + str(jsonOBJ["properties"]["cacheDir"]) + "," + "NA" + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "GPServer":
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
# Build the Service URL to test the running status
if folder:
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["clusterName"]) + "," + "NA" + "," + str(jsonOBJ["properties"]["jobsDirectory"]) + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "GeocodeServer":
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
if folder:
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["clusterName"]) + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "GeoDataServer":
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
if folder:
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "NA" + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["properties"]["maxRecordCount"]) + "," + str(jsonOBJ["clusterName"]) + "," + "NA" + "," + "NA" + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
httpConn.close()
elif item["type"] == "MapServer":
serviceManifestUrl = ""
# Build the Service URL
if folder:
sUrl = "/arcgis/admin/services/%s%s.%s" %(folder,item["serviceName"], item["type"])
serviceManifestUrl = "/arcgis/admin/services/%s%s.%s/%s" %(folder,item["serviceName"], item["type"],"iteminfo")
else:
sUrl = "/arcgis/admin/services/%s.%s" %(item["serviceName"], item["type"])
serviceManifestUrl = "/arcgis/admin/services/%s.%s/%s" %(item["serviceName"], item["type"],"iteminfo")
# Submit the request to the server
httpConn.request("POST", sUrl, params, headers)
# Get the response
servResponse = httpConn.getresponse()
readData = servResponse.read()
jsonOBJ = json.loads(readData)
# Build the Service URL to test the running status
if folder:
statusUrl = "/arcgis/admin/services/%s%s.%s/status" %(folder,item["serviceName"], item["type"])
else:
statusUrl = "/arcgis/admin/services/%s.%s/status" %(item["serviceName"], item["type"])
# Submit the request to the server
httpConn.request("POST", statusUrl, params, headers)
# Get the response
servStatusResponse = httpConn.getresponse()
readData = servStatusResponse.read()
jsonOBJStatus = json.loads(readData)
# Check for Map Cache
isCached = jsonOBJ["properties"]["isCached"]
if isCached == "true":
cacheDir = str(jsonOBJ["properties"]["cacheDir"])
else:
cacheDir = jsonOBJ["properties"]["isCached"]
if len(jsonOBJ["extensions"]) == 0:
# Build the line to write to the output file
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + "FeatServHolder" + "," + "Disabled" + "," + "Disabled" +"," + str(jsonOBJ["properties"]["maxRecordCount"]) + "," + str(jsonOBJ["clusterName"]) + "," + cacheDir + "," + "NA" + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
else:
# Extract the KML properties from the response
kmlProps = [mapKML for mapKML in jsonOBJ["extensions"] if mapKML["typeName"] == 'KmlServer']#.items()[0][1] == 'KmlServer']
# Extract the WMS properties from the response
wmsProps = [mapWMS for mapWMS in jsonOBJ["extensions"] if mapWMS["typeName"] == 'WMSServer']#.items()[0][1] == 'WMSServer']
# Extract the FeatureService properties from the response
featServProps = [featServ for featServ in jsonOBJ["extensions"] if featServ["typeName"] == 'FeatureServer']#.items()[0][1] == 'FeatureServer']
if len(featServProps) > 0:
featureStatus = str(featServProps[0]["enabled"])
else:
featureStatus = "NA"
if len(kmlProps) > 0:
kmlStatus = str(kmlProps[0]["enabled"])
else:
kmlStatus = "NA"
if len(wmsProps) > 0:
wmsStatus = str(wmsProps[0]["enabled"])
else:
wmsStatus = "NA"
ln = str(jsonOBJ["serviceName"]) + "," + folder + "," + str(item["type"]) + "," + jsonOBJStatus['realTimeState'] + "," + str(jsonOBJ["minInstancesPerNode"]) + "," + str(jsonOBJ["maxInstancesPerNode"]) + "," + featureStatus + "," + kmlStatus + "," + wmsStatus +"," + str(jsonOBJ["properties"]["maxRecordCount"]) + "," + str(jsonOBJ["clusterName"]) + "," + cacheDir + "," + "NA" + "," + str(jsonOBJ["properties"]["outputDir"]) +"\n"
# Write the results to the file
serviceResultFile.write(ln)
# Get service manifest info
serviceManifestInfo(serviceManifestUrl,httpConn,params, headers)
else:
# Close the connection to the current service
httpConn.close()
# Close the file
serviceResultFile.close()
def serviceManifestInfo(in_url_fragment,httpConn,params, headers):
# Submit the request to the server
httpConn.request("POST", in_url_fragment + "/manifest/manifest.json", params, headers)
# Get the response
manifestServResponse = httpConn.getresponse()
manifestJsonOBJ = json.loads(manifestServResponse.read())
httpConn.close()
dbObj = manifestJsonOBJ["databases"]
for resource in dbObj:
if len(dbObj) > 0:
print '\nhttps://servername' + in_url_fragment
#print resource["onServerConnectionString"]
#print resource["onPremiseConnectionString"]
print 'byReference ' + str(resource["byReference"])
print 'onServerWorkspace ' + str(resource["onServerWorkspaceFactoryProgID"])
if ("Sde" in resource["onServerWorkspaceFactoryProgID"] ):
print 'onServerConnectionString ' + str(regexpSERVER.search(resource["onServerConnectionString"]).group(0))
print 'onServerConnectionString ' + str(regexpVERSION.search(resource["onServerConnectionString"]).group(0))
print 'onServerConnectionString ' + str(regexpDATABASE.search(resource["onServerConnectionString"]).group(0))
tempDataSets = resource["datasets"]
if len(tempDataSets) > 0:
for dataset in tempDataSets:
print 'dataset ' + str(dataset['onServerName'])
def getToken(username, password, serverName, serverPort):
# Token URL is typically http://server[:port]/arcgis/admin/generateToken
tokenURL = "/arcgis/admin/generateToken"
params = urllib.urlencode({'username': username, 'password': password, 'client': 'requestip', 'f': 'json'})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
# Connect to URL and post parameters
httpConn = httplib.HTTPConnection(serverName, serverPort)
httpConn.request("POST", tokenURL, params, headers)
# Read response
response = httpConn.getresponse()
if (response.status != 200):
httpConn.close()
print "Error while fetching tokens from admin URL. Please check the URL and try again."
return
else:
data = response.read()
httpConn.close()
# Check that data returned is not an error object
if not assertJsonSuccess(data):
return
# Extract the token from it
token = json.loads(data)
return token['token']
# A function that checks that the input JSON object
# is not an error object.
def assertJsonSuccess(data):
obj = json.loads(data)
if 'status' in obj and obj['status'] == "error":
print "Error: JSON object returns an error. " + str(obj)
return False
else:
return True
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
... View more
07-31-2017
10:29 AM
|
0
|
4
|
774
|
Title | Kudos | Posted |
---|---|---|
1 | 08-23-2017 03:25 PM | |
1 | 03-21-2018 09:13 AM | |
1 | 06-14-2017 11:30 AM | |
2 | 01-12-2021 08:57 AM | |
1 | 05-18-2016 01:02 PM |
Online Status |
Offline
|
Date Last Visited |
06-11-2024
05:24 PM
|