To create a route you need the
newRoute mutation and
routeUpdateById subscription. We strongly recommend to use subscriptions. Recursively querying a route ID until the route is processed increases costs and delays your application. A visual representation is added below. For a more detailed explanation keep reading.
First, use your GraphQL client to execute the mutation. This mutation takes a
RequestInput object which contains all the parameters needed to create a route. It returns the
ID of that newly created route. Use that route ID to subscribe to route updates. The status of the route (
RouteStatus) will be updated from
processing, and afterward to the final status
done. If a route is not found or something goes wrong during the calculation the final status resolves to either
error. It is recommended to unsubscribe from further updates when the route has reached a final status.