1 / 9

Python and REST

Python and REST. Kevin Hibma. [NEW] ArcGIS Python API. New API that makes interacting with Esri RESTful technologies easy Going into beta, released with ArcGIS 10.5 Scripting and Automation iPython Notebooks View webmaps , visualize results Not an arcpy replacement.

Download Presentation

Python and REST

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Python and REST Kevin Hibma

  2. [NEW] ArcGIS Python API • New API that makes interacting with EsriRESTful technologies easy • Going into beta, released with ArcGIS 10.5 • Scripting and Automation • iPython Notebooks • View webmaps, visualize results • Not an arcpy replacement.

  3. [NEW] ArcGIS Python API >> conda install –c esri arcgis >> python (optionally) >> conda install jupyter from arcgis.gis import * gis = GIS(“http://www.arcgis.com”, “xxxx”, “xxxx”) gis.groups.list() gis.content.search(“Chiptole”)

  4. What is REST? Why REST? • REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used. REST is an architecture style for designing networked applications. • > rest.elkstein.org/2008/02/what-is-rest.html • Ummm what? (search has a lot of similar definitions) • For this session we’ll use the term REST to loosely describe how we (python scripts) connect and talk to a server / web service end point. • Why? Because its easier than SOAP! (another way to talk across the internet)

  5. What can I do? • ArcGIS Server • Consume, create, update, administer • ArcGIS Online (arcgis.com) • Consume, create, update, configure • Web services (both ArcGIS and not-ArcGIS) • Consume, update (with permission)

  6. Development pattern • (optionally) Authenticate (get a token) depending on operation • Build URLs to hit different end points • http://server/arcgis/rest/service/QUERY • Most requests are POST (vs. GET) • Send and receive a JSON payload • A REST service could send data back in another format

  7. Time for some code

  8. What to put where? (how do I know what a request needs and what a response gives) • Read API help doc • http://esriurl.com/restapi • Use Fiddler • With fiddler running, perform actions in a browser or other client inspect requests / response • WebBrowsers have built in consoles to watch requests URL Query parameters Response

  9. Links • Documentation and examples • http://esriurl.com/scriptRESTAPI • Ready to go tools, scripts and command line • http://esriurl.com/AGStools • Code as iPython notebook • https://github.com/khibma/PythonREST_UC2015

More Related