Is it possible to add a WMTS layer as a basemap with the use of the ArcGIS Automation API ? I can use the Add Layer method like this to add a WMTS layer to the operational layers :
{
"URI": "https://www.arcgis.com/home/item.html?id=c98ec6ff1b26457db28dfa9ca27f144a",
"target": "operationalLayers",
"type": "PortalItem"
}But if I try to do the same for baseMaps :
{
"URI": "https://www.arcgis.com/home/item.html?id=c98ec6ff1b26457db28dfa9ca27f144a",
"target": "baseMaps",
"type": "PortalItem"
}I get this error :
"errorMessage": "Failed to add layer. Invalid request response: Portal item type incorrect"
I know 3 ways of doing this manually.
From the ArcGIS Online tab :

From the Add from Path tab, Portal Item type :

From the Add from Path tab, OGC WMTS type :

But I try to find a way to do it from the Add Layer method of the Automation API. Thank you.