Select to view content in your preferred language

Add item thows error when type isn't specified in the item_properties dictionary

345
0
11-23-2022 06:28 AM
SupriyaK
Regular Contributor

I'm using the API for Python to script adding content. The documentation states that the type key is optional in the item_properties dictionary when adding content. However, when I leave it out I get the following error:
Exception: 'type' and 'title' property required.
(Error Code: 400)

Here is the documentation that I referenced that says type is an Optional string.
https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#contentmanager
(Navigate to>"add">under the "Key:Value Dictionary...." table> note the "type" information


Here is the snippet of code I'm using:

Throws the error above:

 

 

item_prop = {
    "url": url,
    "title": title,
    "description": description,
    "accessInformation": accessInformation,
    "licenseInfo": termsofuse,
}
gis.content.add(item_properties=item_prop)

 

 



Will work:

 

 

item_prop = {
    "type": type_item,
    "url": url,
    "title": title,
    "description": description,
    "accessInformation": accessInformation,
    "licenseInfo": termsofuse,
}
gis.content.add(item_properties=item_prop)

 

 



0 Replies