Job failed while publishing Json file

240
0
10-07-2022 06:56 AM
Jjeremyc
New Contributor

Hello, 

I have a json file that I want to publish. As an example and for test, I replaced the json file directlty with a dictionnary but I have the same problem with the file. This is my code : 

from arcgis.gis import GIS
from IPython.display import display
gis = GIS(username="XX", password="XX")

data = { "type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
"properties": {"prop0": "value0"}
},
{ "type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
]
},
"properties": {
"prop0": "value0",
"prop1": 0.0
}
},
{ "type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0] ]
]

},
"properties": {
"prop0": "value0",
"prop1": {"this": "that"}
}
}
]
}

item_properties_dict = {"type": "GeoJson",
'title': 'Test',
'tags': 'Test',
'snippet': 'Test',
"text":data}

item = gis.content.add(item_properties = item_properties_dict)
item.publish()

 

When I execute this code, I have the following error :

---> 43 item.publish()

File /opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py:13921, in Item.publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache, item_id, geocode_service)
13919 return Item(self._gis, ret[0]["serviceItemId"])
13920 else:
> 13921 serviceitem_id = self._check_publish_status(ret, folder)
13922 return Item(self._gis, serviceitem_id)

File /opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py:14273, in Item._check_publish_status(self, ret, folder)
14271 # print(str(job_response))
14272 if job_response.get("status") in ("esriJobFailed", "failed"):
> 14273 raise Exception("Job failed.")
14274 elif job_response.get("status") == "esriJobCancelled":
14275 raise Exception("Job cancelled.")

Exception: Job failed.

 

Thank you for your help.

0 Kudos
0 Replies