The arcpy.sharing module is a Python module that allows you to automate sharing workflows. Use it to create a sharing draft, which is a configurable set of properties for a web layer, web tool, map service, or geoprocessing service. Creating a sharing draft is the first step in automating the sharing of a GIS resource to ArcGIS Enterprise, ArcGIS Online, or ArcGIS Server.
Depending on whether you're creating a sharing draft for a web layer, web tool, or service, use the following functions:
- To create the sharing draft for a web layer on ArcGIS Enterprise or ArcGIS Online from a map in an ArcGIS Pro project, use the getWebLayerSharingDraft function from the Map class.
- To create the sharing draft for a web imagery layer or web tool on an ArcGIS Enterprise portal, or a map service, image service, or geoprocessing service on a stand-alone ArcGIS Server site, use the CreateSharingDraft function.
The tables below describe the sharing classes and functions.
Sharing classes
Class | Description |
---|---|
Creates a sharing draft for a hosted web feature layer or a hosted table. | |
Creates a sharing draft for a web tool on an ArcGIS Enterprise portal or a geoprocessing service on a stand-alone server. | |
Creates a sharing draft for a web imagery layer on an ArcGIS Enterprise portal or an image service on a stand-alone server. | |
Creates a sharing draft for a map image layer with an optional web feature layer on a federated server. | |
Creates a sharing draft for a map service on a stand-alone server. | |
Creates a sharing draft for a web scene layer with an associated web feature layer. | |
Creates a sharing draft for a web tile layer. | |
Creates a sharing draft for a vector tile layer with an associated web feature layer. |
Sharing functions
Function | Description |
---|---|
Creates a MapServiceDraft, ImageSharingDraft, or GeoprocessingSharingDraft sharing draft class. | |
Publishes either of the following:
|
The sharing draft classes contain the most common web layer, web tool, map service, and geoprocessing service properties. After configuring properties on the sharing draft object, the subsequent steps differ based on the type of sharing class.
The FeatureSharingDraft, TileSharingDraft, MapImageSharingDraft, MapServiceDraft, ImageSharingDraft, and GeoprocessingSharingDraft sharing draft classes can be configured and saved as a service definition draft file (.sddraft) using the exportToSDDraft method. Once the .sddraft file is created, it can be converted to a fully consolidated service definition file (.sd) using the Stage Service tool. This process compiles all the necessary information to publish the GIS resource. Additionally, the Stage Service tool analyzes the .sddraft file for suitability and identifies potential performance issues before converting it to an .sd file. The .sd file can then be uploaded and published as a GIS service to a server federated with ArcGIS Enterprise, a stand-alone ArcGIS Server site, or ArcGIS Online using the Upload Service Definition tool. When the service is published to ArcGIS Enterprise or ArcGIS Online, a corresponding web layer is automatically created.
The SceneLayerSharingDraft and VectorTileSharingDraft sharing draft classes follow a different workflow compared to the other sharing draft classes. After configuring the draft, use the analyzeForSharing method to analyze the SceneLayerSharingDraft or VectorTileSharingDraft object for errors and warnings. The object can then be published as a web scene layer or vector tile layer with an associated web feature layer to ArcGIS Online or ArcGIS Enterprise using the Publish function.