vehicle_start = [-34.9658392782709, -7.1380845]
coordinates= [[-34.9658392782709, -7.1380845], [-34.9071513370733, -7.26357182671599], [-35.4899649848849, -6.852715], [-34.8889419445777, -8.06276248305241]]
body = {
"jobs": [
{"id": 1, "service": 300, "amount": [1], "location": [-34.9658392782709, -7.1380845]},
{"id": 2, "service": 300, "amount": [1], "location": [-34.9071513370733, -7.26357182671599]},
{"id": 3, "service": 300, "amount": [1], "location": [-35.4899649848849, -6.852715]},
{"id": 4, "service": 300, "amount": [1], "location": [-34.8889419445777, -8.06276248305241]}
],
"vehicles": [
{
"id": 1,
"profile": "driving-car",
"start": [-34.9658392782709, -7.1380845],
"capacity": [2000]
}
],
"options": {"g": 'true'}
}
headers = {
'Accept': 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
'Content-Type': 'application/json; charset=utf-8'
}
response = requests.post('vroom_url', json=body, headers=headers)
print(response.json())
this code returns a succes response, but the one bellow returns HTTP error 404
coordinates = [[-34.9658392782709, -7.1380845], [-34.9071513370733, -7.26357182671599],
[-35.4899649848849, -6.852715], [-34.8889419445777, -8.06276248305241]]
jobs, vehicles = list(), list()
vehicle_start = [-34.9658392782709, -7.1380845]
for idx, coord in enumerate(coordinates):
jobs.append(optimization.Job(id=idx, location=coord,amount=[1]))
cap = 5
vehicles = [
optimization.Vehicle(id=0, profile='driving-car', start=vehicle_start, capacity=[cap]),
]
try:
api = Client(base_url='same_vroom_url')
result = api.optimization(jobs=jobs, vehicles=vehicles, geometry=True)
except Exception as e:
print(e)
print(result.json())
i would like to know if im doing anything wrong with the API