Esri / ArcREST

python package for REST API (AGS, AGOL, webmap JSON, etc..)
Apache License 2.0
192 stars 155 forks source link

Question: is it possible to publish a map service in AGS with ArcREST? #110

Closed AlexArcPy closed 8 years ago

AlexArcPy commented 8 years ago

I have developed my own arcpy-based workflows tools for publishing services to AGS site (using arcpy.mapping.CreateMapSDDraft, arcpy.StageService_server, and arcpy.UploadServiceDefinition_server).

Are there any functions in ArcREST for publishing services (it could be directly from .mxd or from .sd) present? I have found the MXDtoFeatureServiceDef but it seems to target AGOL organization.

I believe you cannot create an .sd file without using arcpy, so I am fine another arcpy-based solution.

Am I missing this function in ArcREST?

MikeMillerGIS commented 8 years ago

Check out the publishing class in ArcRest helper.

AlexArcPy commented 8 years ago

Thanks, Mike! Which class do you refer to?

MikeMillerGIS commented 8 years ago

Check out https://github.com/Esri/ArcREST/blob/master/src/arcresthelper/publishingtools.py#L1368

Here is an example of it implemented http://solutions.arcgis.com/utilities/water/help/customer-complaints/

AlexArcPy commented 8 years ago

Thanks, Mike! Are you sure that this can be used for publishing to AGS? It has AGOL organization everywhere in the code; so it looks to me as this is used for publishing feature services to AGOL organization. I am interested in publishing map services into a local AGS site.

MikeMillerGIS commented 8 years ago

Oh my mistake. This is for portal or online

achapkowski commented 8 years ago

When you publish a tool to AGS, you can use the publishing tools in the system folder. You can also use the create service function on ArcGIS Server to do this as well. The easiest way to publish is to just use the core arcpy.mapping tools to ArcGIS Server.
hope this helps.

AlexArcPy commented 8 years ago

Thanks, Andrew. This is how I do it now - with arcpy.mapping tools. I haven't used CreateService, it seems as this will just create a skeleton service with the properties as I don't see any way to get an sd file published, so the service won't have any referenced GIS data. Am I wrong?

If you think it's useful, I could submit a pull request with the arcpy.mapping based workflow for publishing a service, as it seems as ArcREST doesn't have one.

achapkowski commented 8 years ago

I think you have to upload the sd file to server using the upload functions then use the GP publishing tools if you manually want to do it.

This project shows the painprocess of doing it that way: https://bitbucket.org/databasin/ags_tool_deploy

AlexArcPy commented 8 years ago

Thanks for sharing a useful resource. However, this tool provides a command-line interface for packaging and publishing python toolboxes to ArcGIS Server (10.2.x).

I am talking exclusively about map services, no GP services are involved yet :)

achapkowski commented 8 years ago

@AlexArcPy The example does apply to only GP, but map services and GP all publish through the same tool.