Web Service Tasks


API for browsing, adding, editing and deleting Web Service Tasks.

URLs

References

Looking up a Resource (single objects, lists and tabular data)
Creating a Resource
Updating a Resource
Deleting a Resource

Notes

Monitoring Tasks

The progress of certain operations in the system (e.g., Importing Rates, Generating Batches) can be monitored via the Web Service Tasks API.

Here are the steps to monitor the status of any API call that returns a {WebServiceTaskId} for monitoring.

(1) You can poll a WebServiceTaskId to monitor the progress of the operation to determine when it has been completed (it will be at 100% if completed). If there were any errors generated during the operation, the Web Service Task's "Status" field will contain the text "ERROR".

Sample Rate Import at 70 percent
GET ivrapi/webservicetasks/{WebServiceTaskId}

{
  "status": "success",
  "message": "",
  "data": {
    "WebServiceTaskId": 10038,
    "UserId": 5,
    "UserName": "Smith, John",
    "DateTime": "2016-05-31T17:04:53",
    "IoFileName": "Data File.csv",
    "LogFileName": "",
    "ErrFileName": "",
    "PercentComplete": 70,
    "Status": "In progress",
    "Message": ""
  }
}

(2) If the task is successful, the user can download the exported file using the following URL:

GET ivrapi/WebServiceTasks/{WebServiceTaskId}/IoFile

Sample Rate Import at 100 percent

{
 "status": "success",
 "message": "",
 "data": {
    "WebServiceTaskId": 10038,
    "UserId": 5,
    "UserName": "Smith, John",
    "DateTime": "2016-05-31T17:04:53",
    "IoFileName": "Data File.csv",
    "LogFileName": "",
    "ErrFileName": "",
    "PercentComplete": 100,
    "Status": "SUCCESS",
    "Message": ""
  }
}

(3) If the operation failed, the user can download the error and log files using the following URLs:

Error File
GET ivrapi/WebServiceTasks/{WebServiceTaskId}/ErrorFile

Log File
GET ivrapi/WebServiceTasks/{WebServiceTaskId}/LogFile

Sample Rate Import at 100 percent, with errors

{
  "status": "success",
  "message": "",
  "data": {
    "WebServiceTaskId": 10038,
    "UserId": 5,
    "UserName": "Smith, John",
    "DateTime": "2016-05-31T17:04:53",
    "IoFileName": "Sample Rate Plan.csv",
    "LogFileName": "Sample Rate Plan-log.txt",
    "ErrFileName": "Sample Rate Plan-err.txt",
    "PercentComplete": 100,
    "Status": "ERROR",
    "Message": "Some records were not imported.  This may have been caused by a comma in the text of the CSV file or a field with an incorrect value.  All records that were not imported have been saved to an error file with the same name as the import file with \".err\" as the extension."
  }
}

NOTE: There are cases where no error or log files are created, and thus the LogFileName and ErrFileName fields will be empty.

Sample Batch Generation at 100 percent, with errors

{
  "status": "success",
  "message": "",
  "data": {
    "WebServiceTaskId": 10038,
    "UserId": 5,
    "UserName": "Smith, John",
    "DateTime": "2016-05-31T17:04:53",
    "IoFileName": "Batch Export File.txt",
    "LogFileName": "",
    "ErrFileName": "",
    "PercentComplete": 100,
    "Status": "ERROR",
    "Message": "An error 105 occurred during batch generation."
  }
}

If you try to download a non existent file, you will get the following message:

{
  "status":"error",
  "message":"File is empty or does not exist.",
  "data":null
}

Web Service Tasks Object

{
  "status": "success",
  "message": "",
  "data": {
    "WebServiceTaskId": 0,
    "UserId": 0,
    "UserName": "",
    "DateTime": "",
    "IoFileName": "",
    "LogFileName": "",
    "ErrFileName": "",
    "PercentComplete": 0,
    "Status": "",
    "Message": ""
  }
}

Table Definitions

WEB_SERVICE_TASKS

This table stores the threaded database operations used by the Web Service API.

Field Name Type Size Description
WEBCC_SERVICE_TASK_ID tinyint 1 Primary key.
USER_ID smallint 2 Foreign key into the USERS table.
DATE_TIME datetime 8 The date and time this entry was created.
IO_FILENAME varchar 50 The name of the I/O file used for this task.
IO_FILE image (Data dependent) The actual I/O file used for this task.
LOG_FILE image (Data dependent) The .log file generated by this task.
ERR_FILE image (Data dependent) The .err file generated by this task containing any errors.
PERCENT_COMPLETE tinyint 1 The progress of the task.
STATUS varchar 20 The current status of the task.
MESSAGE varchar 1024 Any message returned to the calling application from the web service.