I have a pre-existing, custom routing services that has been used successfully with the JSAPI 3.x for a couple of years. We are in the process of updating to JSAPI 4.x and have run into a behavior issue where the built-in Directions widget is passing parameters to the `route` endpoint that are causing an error to be returned.
Specifically, the 3.x API includes
"simplificationTolerance":null,
"simplificationToleranceUnits":"esriUnknownUnits"
with the travelMode argument which the 4.x API does not. These parameters do not appear to be exposed in the RouteParameters object, which required more .... invasive ... methods to override.
Without these travelMode parameters set, we get the following error response the the "solve" endpoint
{
"error": {
"code":400,
"message":"Invalid or missing input parameters.",
"details":["The following travel mode is invalid: ..."]
}
}
Any recommendations on how to finess/configure the Direction widget to work around this issue; or perhaps even change how the Network Analyst service is published to make it friendlier to the JSAPI 4.x conventions?
Version Details
* ArcGIS Server 10.5.1
* Network Analyst Extension 10.5.1
Hi @LucasScharenbroich, I haven't encountered this scenario before. Would it be possible for you to share the routing service endpoint so I could do some testing? You could also message me directly if you don't want to share it on this post (if it's publicly accessible). Does it also use a custom locator?
It also may be possible that the 3x app overrides the travelMode, making it valid. If that's the case, you should be able to set the current travelMode using this property on the DirectionsViewModel:
Hi @LucasScharenbroich, looks like we'll have this fixed in the next release (4.23), which is expected in late March.