I followed the tutorial https://developers.arcgis.com/python/sample-notebooks/publishing-packages-as-web-layers/ to automate hosted Tile layer publishing
What I want to automate is the below step done in the settings of a hosted Tile layer:
Is it possible to use the API for Python to build Tiles after publishing a Tile SD file?
Not sure if this is the same but I use the arcpy tool to manage my tile cache. Can you check for a similar tool that will suit your needs in the arcgis pro toolbox?
I have been able to accomplish this by using Manage Map Server Cache Tiles via arcpy along with the url property of the item that is returned when using publish(). My code ending up looking like:
tileLayer = sd_item.publish() arcpy.server.ManageMapServerCacheTiles(tileLayer.url, [591657527.591555, 295828763.795777, 147914381.897889, 73957190.948944, 36978595.474472, 18489297.737236, 9244648.868618, 4622324.434309, 2311162.217155, 1155581.108577, 577790.554289, 288895.277144, 144447.638572], 'RECREATE_ALL_TILES')