Set JSON data for Web Mapping Application item in AGOL

279
0
07-18-2022 10:46 AM
VincentLantaca
New Contributor III

I am trying to upload a definition for a Web Mapping Application to ArcGIS Online using arcgis.gis. I have a .json file "testWebMappingApplication.json" where I have defined the data for the app. The problem I am running into is that when I check the item in ArcGIS Online Assistant, I see the description JSON but nothing for data.

 

workspace =  os.path.dirname(os.path.abspath("__file__"))
input_file_name = workspace + r'\testWebMappingApplication.json'

with open(input_file_name) as input_file:
    print('reading {}'.format(input_file_name))
    json_input = input_file.read()
    
default_obj = json.loads(json_input)


ip = {
    "title": "WEBAPP_PYTHONTEST",
    "type": "Web Mapping Application",
    "typeKeywords": [
        "JavaScript",
        "Map",
        "Mapping Site",
        "Online Map",
        "Ready To Use",
        "WAB2D",
        "Web AppBuilder",
        "Web Map"
    ]
}


I have tried several approaches ways of calling gis.content.add: 

# gis.content.add(item_properties=ip, folder="DevTest", data=default_obj) # error
# item = gis.content.add(item_properties=ip, folder="DevTest") # works but no data
# item = gis.content.add(item_properties=ip, folder="DevTest", data=json.dumps(default_obj)) # error
item = gis.content.add(item_properties=ip, folder="DevTest", data=input_file_name) # works but no data in ArcGIS Online Assistant


The last line doesn't give an error but in ArcGIS Online Assistant I don't see the data JSON, instead there is a link to download the file. Is there a way to set the JSON data for the Web Mapping Application item?

0 Kudos
0 Replies