Error with ArcGIS Service Area API call 'code': 400, 'extendedCode': -2147024809, 'message': 'Invalid or missing input parameters.

118
0
2 weeks ago
Labels (2)
SangamRaj
New Contributor

Hi, I made API call for service area but getting below error.
Couldn't understand what is the problem in the pasted code.
Please suggest me options to resolve it.

{'error': {'code': 400, 'extendedCode': -2147024809, 'message': 'Invalid or missing input parameters.', 'details': ['Invalid input coordinates [spatialReference].']}}

url = "https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World/solveSer..."

facilities={
"spatialReference": {
"wkid": 4326
},
"features": [
{
"geometry": {
"x": -118.806574,
"y": 34.013606
},
"attributes": {
"Name": "Fire Station 34",
"Attr_TravelTime": 4
}
},
{
"geometry": {
"x": -118.729687,
"y": 34.070172
},
"attributes": {
"Name": "Fire Station 29",
"Attr_TravelTime": 5
}
}
]
}


params = {
"f": "json",
"token": "hidden token",
"facilities":facilities ,#"-118.806574, 34.013606 ;-118.729687, 34.070172"
"defaultBreaks": [10], # Distance in miles for the service areas
"travelDirection": "esriNATravelDirectionToFacility",
"outSR": 4326
}

# Make POST request to solveServiceArea API
response = requests.post(url, data=params)




0 Kudos
0 Replies