Skip to main content
Version: Version 22

Request the Status of an Import Task via the REST API

The REST API call that executes an import task returns 202 Accepted right away, and the import runs in the background. Previously an integration had no way to find out through the API whether that import was finished or whether it succeeded. You could only check the Log tab of the import task in the Import / Export app.

With this update a new REST call returns the status of an import task and the result of its latest run. Integrations can now wait until one import has finished successfully before they start the next one. This is useful, for example, at the year transition, when several imports must run in a fixed order.


The status call​

GET {baseurl}/service/fortesipm/integration/import/status/{id}

{id} is the node ID of the import task, the same ID you use for integration/import/execute/{id}. Authentication works the same as for the other REST calls, and the caller must be an administrator.

A successful call returns HTTP 200:

{
"status": { "code": 101, "text": "SUCCESSFUL" },
"message": "Import task done",
"details": {
"state": "done",
"lastRun": {
"status": "ok",
"startDate": "2026-11-02 14:00:00",
"endDate": "2026-11-02 14:00:12"
}
}
}

details.state tells you what the import task is doing:

StateMeaning
scheduledAn import started through the REST API is accepted but has not started yet, and no run of the task is in progress. For example, it is waiting for a free worker.
executingA run of the import task is in progress. This includes the case where another import is already waiting behind it.
doneThe task is idle and has run at least once. lastRun holds the result of the latest run.
noneThe task has never run. lastRun is not included.

details.lastRun is the latest log of the import task, the same one you see on the Log tab. Its status is In Progress while the import runs, and then ok, error or rolledback. startDate and endDate use the format yyyy-MM-dd HH:mm:ss in the server time zone. endDate is null while the run is still in progress.

note

The status describes the import task, not one specific run. lastRun always describes the most recent run that has started. Runs started by the task's own schedule or from the user interface are never reported as scheduled.

Example of scheduled​

Imports and exports started through the REST API share 5 workers. Suppose six different import tasks, A to F, are started through the REST API at the same moment:

  • A to E each get a worker and report executing.
  • F has to wait for a free worker, so it reports scheduled.
  • When one of A to E finishes, F starts and reports executing. When F is finished, it reports done.

In practice scheduled mostly lasts a split second, between the 202 response and the moment a worker starts the import. A client usually only sees it when many imports or exports are started at once.


Waiting for an import to finish​

  1. Start the import with POST integration/import/execute/{id}.
  2. Call GET integration/import/status/{id} every few seconds until details.state is done.
  3. Check details.lastRun.status. The import succeeded when it is ok.

The call returns HTTP 400 with status code 102 when the caller is not an administrator, or when the ID does not exist or does not belong to an import task.

See the REST API article for the full reference, and Imports & Exports for setting up import tasks.