API async - RapturePlatform/Rapture GitHub Wiki

Async API

The Async API works closely with the Pipeline API - it puts tasks onto the Pipeline for future execution. The most often used call is one where a Reflex script is scheduled for execution, using the asyncReflex* calls.

asyncReflexScript

HttpAsyncApi asyncApi = new HttpAsyncApi(loginApi);
String retVal = asyncApi.asyncReflexScript(reflexScript, parameters);
retVal = baseAPI.doAsync_AsyncReflexScript(reflexScript, parameters);

Entitlement: /async/reflex

Run a passed script in an asynchronous manner. Tells Rapture to run the script as part of a predefined internal workflow, and returns workOrderURI that can be used in other calls to retrieve the status. The second parameter is the set of parameters that will be passed to the script upon execution.

Function Parameters

Parameter Type Description
reflexScript String
parameters Map<String,String>

Return value

Type Description
String

asyncReflexReference

HttpAsyncApi asyncApi = new HttpAsyncApi(loginApi);
String retVal = asyncApi.asyncReflexReference(scriptURI, parameters);
retVal = baseAPI.doAsync_AsyncReflexReference(scriptURI, parameters);

Entitlement: /async/reflex

Run a script that has already been loaded onto Rapture in an asynchronous manner. The script is named through its uri. As with asyncReflexScript, the parameters passed in the last parameter to this function are passed to the script upon invocation, and the return value from this function is a workOrderURI that can be used to determine the ultimate status of this WorkOrder.

Function Parameters

Parameter Type Description
scriptURI String
parameters Map<String,String>

Return value

Type Description
String

asyncStatus

HttpAsyncApi asyncApi = new HttpAsyncApi(loginApi);
WorkOrderStatus retVal = asyncApi.asyncStatus(taskId);
retVal = baseAPI.doAsync_AsyncStatus(taskId);

Entitlement: /admin/main

Retrieve the status of a given async task. Will return null if the task id is not known to the environment.

Function Parameters

Parameter Type Description
taskId String

Return value

Type Description
WorkOrderStatus
Types used in this function

WorkOrderStatus

The status of a work order.

Field Type
workerIds List
status WorkOrderExecutionState

setupDefaultWorkflows

HttpAsyncApi asyncApi = new HttpAsyncApi(loginApi);
void retVal = asyncApi.setupDefaultWorkflows(force);
retVal = baseAPI.doAsync_SetupDefaultWorkflows(force);

Entitlement: /admin/async

Sets up workflows needed to run any of these scripts. Should be called by Rapture internally on init

Function Parameters

Parameter Type Description
force boolean

Return value

Type Description
void
⚠️ **GitHub.com Fallback** ⚠️