I would like to use the ExportXMLWorkspaceDocument geoprocessing tool (in arcpy) to generate an XML document (schema only) from an API for Python item object of a file geodatabase (FGDB) that currently resides in the Content/My Content area of my company's AGOL portal. The FGDB is an export of a hosted feature service (hosted feature layer collection, to be precise) generated with code like:
result = item_object.export(feature_layer_name, 'File Geodatabase')
itemID = result.id
During the run, I have item_object (the feature service Item) and result (the FGDB Item). I would export the XML document with the geoporcessing tool thus:
arcpy.management.ExportXMLWorkspaceDocument(in_data, out_file, 'SCHEMA_ONLY')
I am in many ways an AGOL and REST novice (though the Python API does make a lot of sense), and I find the various types of URL formats and what they point to quite confusing. So, I suppose I have two questions, really:
- What value would I use for arcpy.env.workspace? (Maybe I don't need to set this if I am using fully qualified URLs all around?)
- What value would I use for the in_data parameter of the tool call to refer properly to the FGDB in My Content?
I assume that these values are going to be various combinations of URLs and item IDs, but I am really confused now and have had no luck getting this to work. (I did see that there is an item_card property for an Item object, but even if that would do the same thing as the geoprocesing tool (which I doubt), there seems to be no parameter for restricting to schema only output.) Any help with this stuff would be greatly appreciated. As I have 28 feature services to do this for, I would really like to get the automation working.