Polling
Polling means your application periodically GETs the dataset metadata and checks the solverStatus field until it reaches SOLVING_COMPLETED, SOLVING_FAILED, or SOLVING_INCOMPLETE.
Use polling only when neither Webhooks nor Server sent events (SSE) are viable, for example, if your application runs in an environment where outbound streaming connections aren’t supported.
The main drawback is that polling creates unnecessary load and introduces latency proportional to your poll interval. If you do poll, use a backoff strategy: start with a short interval and increase it for longer-running solves rather than polling at a fixed rate.
In production, we recommend configuring Webhooks to retrieve the solutions to your submitted datasets from Timefold.
In local development environments, we recommend Server sent events (SSE), however, when server sent events are not possible, you can poll Timefold.
Configuring polling
To poll for the solution to a dataset, use the dataset ID from the response to the POST operation and make a GET request to the following endpoint:
/v1/{model-entity-name}/<ID>/metadata
-
Replace
<ID>with the dataset ID. -
For field service routing and pick-up and delivery routing, replace
{model-entity-name}withroute-plans. -
For employee shift scheduling, replace
{model-entity-name}withschedules.
| Read dataset lifecycle to know which statuses exist and which ones are final. |
See Webhooks for more information.