Overwrite service using PublishingTools/GPServer/Publish Service Definition REST API

861
2
Jump to solution
12-06-2021 07:47 PM
AndyArismendi1
New Contributor III

Hi, I see there's a parameter named "in_publish_options" for PublishingTools/GPServer/Publish Service Definition. Is it possible to use this to set the flag to overwrite the service as ArcGIS Desktop provides? I tried to look at what Desktop does with fiddler but all the services calls are SOAP binary so I didn't see what parameters and values were sent. I haven't seen any documentation for this parameter yet...

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AndyArismendi1
New Contributor III

Thanks! I used to use ArcPy's UploadServiceDefinition but sometimes it fails with 99999 invalid URL and I've had more consistency calling the APIs it calls directly (the process is in the link below).

Thanks for pointing me to the service definition, it looks like this is what I'm looking for -

Change: <Type>esriServiceDefinitionType_New</Type>

To: <Type>esriServiceDefinitionType_Replacement</Type>

 

https://gis.stackexchange.com/questions/337709/publishing-service-using-service-definition-file-sd-t...

View solution in original post

2 Replies
LongDinh
Occasional Contributor II

Hi Andy,

In the latest version of ArcGIS Pro, the overwrite functionality is provided. You shouldn't really interface with System/PublishingTools as it alters properties in your Portal and destination ArcGIS Server. Documentation is probably limited to ESRI Inc developers and those who can traverse the server's arcgissystem directories. The code is probably minified/uglified anyway..

What happens when you use an application interface like ArcGIS Pro/ArcMap (or Python APIs e.g. arcpy, arcgis ) is the tool will call a number of PublishingTools/GPServer GPTasks to make updates to your Portal and destination ArcGIS Server. 

To overwrite, you can manually change the service defintion draft and restage the draft by adding in specific xml tags which indicate to the PublishingTools/GPServer/Publish Service Definiton GPTask to overwrite instead of publish. You can use the CreateSDDraft tool to see how that is written and apply it to an existing SD file.

Hope this info provides some insight 🙂

AndyArismendi1
New Contributor III

Thanks! I used to use ArcPy's UploadServiceDefinition but sometimes it fails with 99999 invalid URL and I've had more consistency calling the APIs it calls directly (the process is in the link below).

Thanks for pointing me to the service definition, it looks like this is what I'm looking for -

Change: <Type>esriServiceDefinitionType_New</Type>

To: <Type>esriServiceDefinitionType_Replacement</Type>

 

https://gis.stackexchange.com/questions/337709/publishing-service-using-service-definition-file-sd-t...