Managing Replays
The services for replay management are available in the TW.AnalysisServices.ReplayManagementServicesAPI resource.
The following table provides information about the purpose, input parameters, and the result of each service:
Service Name and Purpose
Input Parameters
Result
Parameter Name
Base Type
Description
CreateReplay — Creates an analysis replay and the replay records according to the inputs in the selected time duration.
name
String
Specifies the name of the replay.
Returns the created replay entry in the form of an infotable that has the TW.AnalysisServices.ReplayManagerDataShape data shape.
It throws an exception if a replay exists for the user. To create a replay, you must delete the existing replay.
description
String
Specifies the description of the replay.
eventId
String
Specifies the analysis event that is to be replayed. This parameter must be specified.
startTime
Datetime
Specifies the start time of the replay. If this parameter is not specified, the value of startTime is set to an hour less than the current time of the system.
endTime
Datetime
Specifies the end time of the replay. If this parameter is not specified, the value of endTime is set to the current time of the system.
dataSource
Thingname
Specifies the data source of the replay. If this parameter is not specified, its value is automatically set to the data source of the event. This parameter must be specified if the event is defined on a thing shape or thing template, and the data source must inherit from the thing shape or thing template that the event is defined on.
dataSourceProperty
String
Specifies the data change property of the selected dataSource on which replay is to be recorded. If the property is not specified, set the value of this parameter to ANY so that the replay can be executed on any property change of the selected source. Do not set this parameter if the value of replayType is set to STEPPED or REALTIME.
host
String
This parameter is optional. Set the value of this parameter if you want to run the replay on a specific host. The default value is ANY which allows the replay to run on any host.
replayType
String
Specifies the type of replay as one of the following types:
REALTIME — If the specified analysis event is based on a ThingWorx data change event (specific property change or any data change), then set replayType to REALTIME or STEPPED.
STEPPED — If the analysis is to be run at a specified frequency, set the value of replayType to STEPPED.
If the event is not based on property change and the value of replayType is not specified, the default value is set to STEPPED.
PROPERTYCHANGE — If the analysis is to be run on a specific property change or any property change of the specified dataSource, then replayType must be set to PROPERTYCHANGE.
runAsContinuous
Boolean
Set the value to true if you want the replay to be executed continuously. The default value is false.
replayInterval
Long
Specifies the time interval in seconds at which a STEPPED replay must be executed. The default value is 60 seconds.
mapResults
Boolean
Set the value to true if the results of replay execution are to be mapped to the entities that are defined in the selected event result mapping. You can map replay results only if the selected analysis event is not enabled. The default value is false.
executionMode
String
Specify the replay execution mode as one of the following:
CONTINUOUS — Once the replay starts, the replay entries in the selected time frame are executed continuously. Use the PauseReplay and ResumeReplay to pause and resume the replay respectively.
STEPBYSTEP — Once the replay starts, the replay entries in the selected time frame are executed only when the user manually uses the Next and Previous services.
SINGLEEXECUTION — All the replay entries in the selected time frame are executed as a single job input for analysis. A single execution job is submitted as an asynchronous analysis job.
DeleteReplay — Deletes the replay and associated records. Use this service when you want to perform a cleanup of replay data.
replayId
String
Specifies the ID of the replay to be deleted.
Returns a message that states the successful completion or errors that occur during the execution of the service.
ExecuteReplay — Executes the replay instance.
replayId
String
Specifies the ID of the replay to be resumed.
Returns the result of the execution in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape.
It throws an error if the specified replay is in the paused state.
executionId
Long
Specifies the ID of the replay to be executed.
ExportReplayData — Exports the replay data to the TW.AnalysisServices.ReplayExportRepository repository. This file includes results of only those entries that have been executed.
replayId
String
Specifies the ID of the replay whose data you want to export.
Returns the repository URL where the XML file is saved.
exportFormat
String
Specifies the format of the exported replay data file as one of the following:
JSON
XML
GetCurrentUserReplay — Obtains replay configuration of the current user.
Returns replay configuration of the current user in the form of an infotable that has the TW.AnalysisServices.ReplayManagerDataShape data shape.
* 
The key attribute of the returned infotable is the value of the replayId parameter.
GetModelDeployStatus — Obtains the deployment status of the specified model
modelName
String
Specifies the name of the model.
Returns the status of model deployment as one of the following:
DEPLOY_COMPLETE
DEPLOY_FAILED
provider
String
Specifies the name of the provider.
host
String
This parameter is optional.
Specifies the host on which you want to deploy the model. If you do want to deploy the model on a specific host, you can specify this value as any.
GetReplay — Obtains information about the replay.
replayId
String
Specifies the ID of the replay.
Returns information about the specified replay in the form of an infotable that has the TW.AnalysisServices.ReplayManagerDataShape data shape.
GetReplayError — Obtains the error information, if any for the specified analysis replay.
replayId
String
Specifies the ID of the replay for which you want to obtain error information.
Returns error information, if any, of the specified analysis replay.
GetReplayErrorForExecution — Obtains the error information, if any for the specified record of the analysis replay.
replayId
String
Specifies the ID of the replay for which you want to obtain error information.
Returns error information, if any, of the specified record of the analysis replay.
executionId
LONG
Specifies the execution ID of the replay record.
GetReplayExecutionHistory — Returns all the records for the given replay. Each record consists of the execution ID, inputs, input timestamp, status and results, if the record is executed.
replayId
String
Specifies the ID of the replay to be queried.
Returns the replay instances in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape.
maxItems
Number
Specifies the maximum number of replay records that you want to export.
ImportReplayResults — Imports the replay from the specified fileUrl.
* 
Use this service if you have exported the replay data by using ExportReplayData, and have performed offline computations using an external analysis tool.
* 
Ensure that the replay exists in the system.
fileUrl
Hyperlink
Specifies the ThingWorx repository file URL where the exported replay file is saved.
Returns a message that states the successful completion or errors that occur during the execution of the service.
fileFormat
String
Specifies the format of the exported replay file as one of the following types:
JSON
XML
IsModelDeployed — Checks if the specified model and provider combination has been deployed on a host.
modelName
String
Specifies the name of the model.
Returns a boolean value of true if the specified model has been deployed.
provider
String
Specifies the name of the provider.
host
String
This parameter is optional.
Specifies the host on which the model that is deployed is to be checked.
Next — This is supported only for replays configured to run in non-continuous mode. Executes the replay record after the last executed record. Ensure that the replay has been started before calling this service.
replayId
String
Specifies the ID of the replay of which next record is to be executed.
Returns the result of the executed entry in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape. It throws an exception if all the replay entries are already executed, that is, there is no entry that can be executed after the current entry.
PauseReplay — Pauses the replay if the replay is configured to run in continuous mode. Ensure that the replay has been started before calling this service.
replayId
String
Specifies the ID of the replay to be paused.
Returns the result of the entry executed before the replay is paused in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape.
Previous — This is supported only for replays configured to run in non-continuous mode. Executes the replay record before the last executed record. Ensure that the replay has been started before calling this service.
replayId
String
Specifies the ID of the replay of which previous record is to be executed.
Returns the result of executed entry in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape. It throws an exception if the last executed entry is the first entry, that is, there is no entry that can be executed before the current entry.
RestoreReplay — Restores the replay from the ONHOLD state.
replayId
String
Specifies the ID of the replay to be restored.
Returns the result of entry executed after the replay is restored in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape.
ResumeReplay — Resumes the paused replay if the replay is configured to run in continuous mode. Ensure that the replay has been paused before calling this service.
replayId
String
Specifies the ID of the replay to be resumed.
Returns the result of entry executed after the replay is resumed in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape.
SetReplayStatus — Sets the status of the replay on the server.
* 
You cannot set the replay status, if the status of the replay is already set.
replayId
String
Specifies the ID of the replay.
Returns a message that states the successful completion or errors that occur during the execution of the service.
status
String
Specifies the status of the replay as one of the following:
COMPLETED
FAILED
ABORTED
errorInfo
Infotable
This parameter is optional.
If you set the status as FAILED, you can display an error message along with the FAILED status. Specify the error message as a value of this parameter.
SetReplayStatusForExecution — Sets the status of a particular record of the analysis replay on the server.
* 
You cannot set the replay status, if the status of the replay is already set.
replayId
String
Specifies the ID of the replay.
Returns a message that states the successful completion or errors that occur during the execution of the service.
executionId
LONG
Specifies the execution ID of the replay record.
status
String
Specifies the status of the replay as one of the following:
COMPLETED
FAILED
errorInfo
Infotable
This parameter is optional.
If you set the status as FAILED, you can display an error message along with the FAILED status. Specify the error message as a value of this parameter.
StartDeployModel — Deploys the specified analysis model on the specified host.
modelName
String
Specifies the name of the model.
Depending on the status of the execution of this service, returns DEPLOY_COMPLETE or DEPLOY_FAILED.
provider
String
Specifies the name of the provider.
host
String
This parameter is optional.
Specifies the host on which you want to deploy the model. If you do want to deploy the model on a specific host, you can specify this value as any.
StartReplay — Starts the replay based on one of the following configurations:
If the replay is set to run in non-continuous mode, it executes the first entry.
If the replay is set to run in continuous mode, it executes the replay entries one after the other.
replayId
String
Specifies the ID of the replay to be started.
Returns the result of the first executed relay in the form of an infotable that has the TW.AnalysisServices.ReplayExecutionDataShape data shape.
Was this helpful?