Checking Long Task Status
Our sample projects and report templates can help you learn the basics of working with our products.A long export can be started asynchronously and its progress polled through the Server REST API task status.
Start the export, then read the task status.
How it works. The export is a background task keyed by id, so a client can start it and check on its progress without holding the connection open.
Start the export, then read the task status.
// Run the template producing a task key
var export = WebRequest.Create($"{RestUrl}/reporttemplates/{ReportTemplateKey}/run");
export.Method = "PUT";
export.Headers.Add("x-sti-SessionKey", sessionKey);
export.Headers.Add("x-sti-DestinationItemKey", pdfFileItemKey);
var taskKey = GetResponseJson(export).Value<string>("ResultTaskKey");
// Poll the task status
var statusReq = WebRequest.Create($"{RestUrl}/task/{taskKey}");
statusReq.Headers.Add("x-sti-SessionKey", sessionKey);
var status = GetResponseJson(statusReq).Value<JObject>("ResultStatus");
// status["IsRunning"], status["IsFinished"], status["IsError"] ..."));ResultTaskKey— the export runs asynchronously and returns a task key instead of blocking./task/{taskKey}→ResultStatus— poll forIsWaiting/IsRunning/IsFinished/IsError.
How it works. The export is a background task keyed by id, so a client can start it and check on its progress without holding the connection open.