- Source:
 
Methods for tasks.
Methods
(static) listing() → {Promise.<Array.<({LastRunTimeUTC: string, LastRunTime: string, Success: boolean, Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string}|{Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string})>>}
- Source:
 - Since:
 - 1.0.0
 
Returns the list of scheduled tasks for a Caspio account.
Example
// get list of all scheduled tasks for a Caspio account
const caspio = require('caspio-sdk')(caspioCredentials);
async function getScheduledTasks() {
  const scheduledTasks = await caspio.tasks.listing();
  console.log(scheduledTasks);
  return scheduledTasks;
}
getScheduledTasks();
// sample return value
[
  ...,
  {
    LastRunTimeUTC: '2022-01-29T06:49:07',
    LastRunTime: '2022-01-29T06:49:07',
    Success: true,
    Name: 'Demo_Physicians_Export',
    ExternalKey: 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157',
    Status: 'Ready',
    TaskTimeZone: 'UTC',
    Frequency: '1 of the month',
    Note: ''
  },
  ...
]
Returns:
Array of objects where each object contains properties of a scheduled task
- Type
 - Promise.<Array.<({LastRunTimeUTC: string, LastRunTime: string, Success: boolean, Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string}|{Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string})>>
 
(static) propertiesByKey(externalKey) → {Promise.<({LastRunTimeUTC: string, LastRunTime: string, Success: boolean, Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string}|{Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string})>}
- Source:
 - Since:
 - 1.0.0
 
Returns properties of the task whose Task ID is externalKey.
Example
// returns properties of the task whose Task ID is 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157'
const caspio = require('caspio-sdk')(caspioCredentials);
async function getTaskProperties() {
  const TASK_ID = 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157';
  const taskProperties = await caspio.tasks.propertiesByKey(TASK_ID);
  console.log(taskProperties);
  return taskProperties;
}
getTaskProperties();
// sample return value
{
  LastRunTimeUTC: '2022-01-29T06:49:07',
  LastRunTime: '2022-01-29T06:49:07',
  Success: true,
  Name: 'Demo_Physicians_Export',
  ExternalKey: 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157',
  Status: 'Ready',
  TaskTimeZone: 'UTC',
  Frequency: '1 of the month',
  Note: ''
}
    Parameters:
| Name | Type | Description | 
|---|---|---|
externalKey | 
            
            string | Task ID  | 
        
Returns:
Object containing properties of the specified scheduled task
- Type
 - Promise.<({LastRunTimeUTC: string, LastRunTime: string, Success: boolean, Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string}|{Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string})>
 
(static) propertiesByName(taskName) → {Promise.<({LastRunTimeUTC: string, LastRunTime: string, Success: boolean, Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string}|{Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string})>}
- Source:
 - Since:
 - 1.0.0
 
Returns properties of taskName, a scheduled task.
Example
// get properties of the task with name 'Demo_Physicians_Export'
const caspio = require('caspio-sdk')(caspioCredentials);
async function getTaskProperties() {
  const TASK_NAME = 'Demo_Physicians_Export';
  const taskProperties = await caspio.tasks.propertiesByName(TASK_NAME);
  console.log(taskProperties);
  return taskProperties;
}
getTaskProperties();
// sample return value
{
  LastRunTimeUTC: '2022-01-29T06:49:07',
  LastRunTime: '2022-01-29T06:49:07',
  Success: true,
  Name: 'Demo_Physicians_Export',
  ExternalKey: 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157',
  Status: 'Ready',
  TaskTimeZone: 'UTC',
  Frequency: '1 of the month',
  Note: ''
}
    Parameters:
| Name | Type | Description | 
|---|---|---|
taskName | 
            
            string | Task name  | 
        
Returns:
Object containing properties of the specified scheduled task
- Type
 - Promise.<({LastRunTimeUTC: string, LastRunTime: string, Success: boolean, Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string}|{Name: string, ExternalKey: string, Status: string, TaskTimeZone: string, Frequency: string, Note: string})>
 
(static) runByKey(externalKey) → {Promise.<{status: 200, statusText: 'OK', message: string}>}
- Source:
 - Since:
 - 1.0.0
 
Runs the scheduled task whose Task ID is externalKey.
Example
// runs the scheduled task whose Task ID is 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157'
const caspio = require('caspio-sdk')(caspioCredentials);
async function runTask() {
  const TASK_ID = 'b7c3b7d5-4fa5-4725-86a2-6ca5ca797157';
  const taskResult = await caspio.tasks.runByKey(TASK_ID);
  console.log(taskResult);
  return taskResult;
}
runTask();
// sample return value
{
  status: 200,
  statusText: 'OK',
  message: 'Task ran successfully.'
}
    Parameters:
| Name | Type | Description | 
|---|---|---|
externalKey | 
            
            string | Task ID  | 
        
Returns:
Object with information about attempted running of the scheduled task (i.e., status, statusText, and message).
- Type
 - Promise.<{status: 200, statusText: 'OK', message: string}>
 
(static) runByName(taskName) → {Promise.<{status: 200, statusText: 'OK', message: string}>}
- Source:
 - Since:
 - 1.0.0
 
Runs the scheduled task with name taskName.
Example
// runs the 'Demo_Physicians_Export' scheduled task
const caspio = require('caspio-sdk')(caspioCredentials);
async function runTask() {
  const TASK_NAME = 'Demo_Physicians_Export';
  const taskResult = await caspio.tasks.runByName(TASK_NAME);
  console.log(taskResult);
  return taskResult;
}
runTask();
// sample return value
{
  status: 200,
  statusText: 'OK',
  message: "Task 'Demo_Physicians_Export' ran successfully."
}
    Parameters:
| Name | Type | Description | 
|---|---|---|
taskName | 
            
            string | Task name  | 
        
Returns:
Object with information about attempted running of the scheduled task (i.e., status, statusText, and message).
- Type
 - Promise.<{status: 200, statusText: 'OK', message: string}>