<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Call ArcGis Server Service from python in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/call-arcgis-server-service-from-python/m-p/353450#M12262</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Jason&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, you can (for example) use the service's REST endpoint from within a Python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example request from a tool I'm working on that batch geocodes recordset objects (what the GP service is expecting as an input parameter):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;response = urllib2.urlopen(serviceEndpoint + "/submitJob?&amp;amp;f=json","&amp;amp;Record_Set="+b).read()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"b" is a RecordSet created earlier in the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;JSON responses are easy to handle with Python, here is how I catch my GP service result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;response = urllib2.urlopen(u).read()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fDict = json.loads(response)["value"]["features"] #Yields a dictionary of JSON encoded features&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"u" is a URL to each job result I loop through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The details of your sent and received objects will be specific to your GP service, but easily determined from the REST endpoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Apr 2011 14:07:00 GMT</pubDate>
    <dc:creator>BruceHarold</dc:creator>
    <dc:date>2011-04-01T14:07:00Z</dc:date>
    <item>
      <title>Call ArcGis Server Service from python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/call-arcgis-server-service-from-python/m-p/353449#M12261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have seen examples of how to use python to open and manipulate an .mxd file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to call a service from python to do something similar?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a service that contains a basemap and a business layer.&amp;nbsp; I want to call that service, locate the map to a specific extent (either through the call to the service itself or afterward in python), and then save the resulting map to a .pdf.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts/ideas?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2011 15:04:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/call-arcgis-server-service-from-python/m-p/353449#M12261</guid>
      <dc:creator>JasonThiel</dc:creator>
      <dc:date>2011-03-31T15:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Call ArcGis Server Service from python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/call-arcgis-server-service-from-python/m-p/353450#M12262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Jason&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, you can (for example) use the service's REST endpoint from within a Python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example request from a tool I'm working on that batch geocodes recordset objects (what the GP service is expecting as an input parameter):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;response = urllib2.urlopen(serviceEndpoint + "/submitJob?&amp;amp;f=json","&amp;amp;Record_Set="+b).read()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"b" is a RecordSet created earlier in the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;JSON responses are easy to handle with Python, here is how I catch my GP service result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;response = urllib2.urlopen(u).read()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fDict = json.loads(response)["value"]["features"] #Yields a dictionary of JSON encoded features&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"u" is a URL to each job result I loop through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The details of your sent and received objects will be specific to your GP service, but easily determined from the REST endpoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 14:07:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/call-arcgis-server-service-from-python/m-p/353450#M12262</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2011-04-01T14:07:00Z</dc:date>
    </item>
  </channel>
</rss>

