I am trying to automate the publishing of maps as services from ArcGIS Pro. There appear to be several tools available through arcpy to accomplish this by creating an sddraft, staging a service, and uploading a service definition. (https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/introduction-to-arcpy-sharing.htm)
When manually publishing a service using the 'sharing map as web layer' pane there are several options that I do not see available using the arcpy methods mentioned above.
I am looking for a way to publish services and add this capability using arcpy, or the python api if there are any functions or methods that might accomplish this there.
Any help would be very much appreciated.
Try opening up the .sddraft file that you created. It is an XML file and it might have a section regarding linear referencing that you can edit using Python.
Also, I think you can access the .sddraft that is created while you are publishing through ArcGIS Pro. It is probably in your user folder and you might have to check for it at the right step in the publishing process.
I went through this whole process very slowly in ArcMap. I used Fiddler to look at the network traffic for the REST API calls that are made to understand the process and I also saved out the .sddraft file from ArcMap during the publishing process. Once I understood all the steps and changes that needed to be made to the .sddraft file, I was able to automate it all in Python. This was about 4 years ago.