Using a restAPI python server app, makes a request to a url and runs python api code to create a new service and layer from an empty hosted feature layer in Portal, then passes the url of the new layer back to the client so it can be edited.
To create the new hosted feature layer from an existing empty hosted feature layer I am using
target_item = template_layer.copy_feature_layer_collection(layout_name,
layers=layer_index,
description="New Layer Created From Template",
owner=target_user.username)
I've not attempted this as a GP Service / WebTool again recently though to see if this data type is supported. It is something I will be testing again soon though.