Scheduled Flows

Schedule Flows

The schedule flows api deals with the scheduling of flows. It facilitates the creation and deletion of schedules, it also provides the activation and deactivation of scheduled flows.

GET /api/customer/:customer_id/number/:service_number_id/history

Retrieve details for a single service number’s scheduling history. This query allows a client to access the full schedule of flows for the service number.

This request supports the following parameters:

Parameter Example Description
customer_id 3518 [URL parameter], [Required] The ID of the customer whose announcements are to be retrieved.
sn 1421525 [URL parameter], [Required] This must be the service number ID, not the service number itself.

Response Content

The response will be a JSON array of objects, with each object consisting of the following information.

Key Type Description
call_plan_id String The unique of the currently scheduled flow, if there is one.
call_plan_name String The name of the currently scheduled flow, if there is one.
call_plan_version Integer The version of the currently active flow in effect, if there is one.
change_user String The name of the last user to change the service number data.
change_date Date The date at which the service number was last changed. The date will be provided as a string in ISO 8601 format.
customer_id Integer The unique ID of the customer to which this service number belongs.
effective_date Date The timestamp at which this schedule took effect (or is to take effect). The date is provided as a string in ISO 8601 format.
id Integer The unique ID of the service number.
is_schedule_activated Integer 1 or 0, indicating whether this schedule is active. An active schedule may not actually be in use as it may be superseded by another schedule.
sn String The actual service number.
schedule_id Integer The ID of the schedule.

Examples

Request:

curl 'http://localhost/jarvis-agent/n2fe/api/customer/53108/number/109501/history' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'

Response:

[
   {
      "is_schedule_activated" : "1",
      "call_plan_name" : "flow",
      "sn" : "0800564177",
      "change_user" : "OPS$ACS_OPER",
      "call_plan_version" : "9",
      "call_plan_id" : "190595",
      "customer_id" : "53108",
      "change_date" : "2018-04-23T00:05:03Z",
      "schedule_id" : "201804030326123409501",
      "id" : "109501",
      "effective_date" : "2018-04-03T03:26:34Z"
   },
   {
      "schedule_id" : "201804030324001249501",
      "effective_date" : "2018-04-03T03:24:00Z",
      "id" : "109501",
      "customer_id" : "53108",
      "change_date" : "2018-04-23T00:05:03Z",
      "change_user" : "OPS$ACS_OPER",
      "call_plan_id" : "190795",
      "call_plan_version" : "9",
      "is_schedule_activated" : "1",
      "sn" : "0800325177",
      "call_plan_name" : "flow"
   }
   ...
]

POST /api/customer/:customerId/number/:serviceNumberId/history/

Supports the creation of schedules for a service number.

This request supports the following parameters:

Parameter Example Description
customer_id 3518 [URL parameter], [Required] The ID of the customer whose announcements are to be retrieved.
sn 1421525 [URL parameter], [Required] This must be the service number ID, not the service number itself.

The content of the POST request must be a JSON object with the following fields:

Key Type Description
customerId Integer The ID of the customer the SN belongs to.
planId Integer effectiveDate + serviceNumberId.
serviceNumberId Integer The ID of the SN getting the new schedule.
effectivePlan Integer The ID of the flow being scheduled.
effectiveDate Integer The timestamp at which this schedule took effect (or is to take effect). The date is provided as a string in ISO 8601 format.

File sn.json:

{
   "customerId":"50203"
   ,"planId":"20180503050927109491"
   ,"serviceNumberId":"109491"
   ,"effectivePlan":"190460"
   ,"effectiveDate":"20180503050927"
}

Response Content

The response will be a JSON array of objects, with each object consisting of the following information.

Key Type Description
error_string String If the user is not logged in, or another error occurs, the error will be described in this field.
group_list String If authenticated this field will exist and provide a comma separate list of groups the user has been authenticated with.
logged_in Integer If 1, the user is logged in. If 0, the user is not logged in.
modified Boolean Indication of whether the schedule was modified successfully.
success Boolean The success status of the scheduling.
username String If authenticated this field will exist and privide the username the user is logged in with.

Examples

curl -T sn.json -H 'Content-Type: application/json;charset=utf-8' 'http://localhost/jarvis-agent/n2fe/api/customer/50203/number/109491/history/plan' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
{
   "username" : "su",
   "error_string" : "",
   "modified" : 1,
   "logged_in" : "1",
   "success" : 1,
   "group_list" : "ACS_BOSS,BCD_BOSS,CCS Superuser"
}

PUT /api/customer/:customerId/number/:serviceNumberId/history/

Used to update scheduling of flows, in particular whether future flows are enabled or disabled.

The content of the PUT request must be a JSON object with the following fields:

Key Type Description
schedule_id Integer The id of the schedule we are updating.
planId Integer The id of the call plan in the schedule.
is_schedule_activated Integer The activation status of the schedule.
customerId Integer The id of the customer.
serviceNumberId Integer The id of the SN the schedule belongs to.

File sn.json:

{
   "schedule_id":"2018132416548909491"
   ,"planId":"189776"
   ,"is_schedule_activated":2
   ,"customerId":"50203"
   ,"serviceNumberId":"109591"
}

Response Content

The response will be a JSON array of objects, with each object consisting of the following information.

Key Type Description
error_string String If the user is not logged in, or another error occurs, the error will be described in this field.
group_list String If authenticated this field will exist and provide a comma separate list of groups the user has been authenticated with.
logged_in Integer If 1, the user is logged in. If 0, the user is not logged in.
modified Boolean Indication of whether the schedule was modified successfully.
success Boolean The success status of the scheduling.
username String If authenticated this field will exist and privide the username the user is logged in with.

Examples

curl -T sn.json -H 'Content-Type: application/json;charset=utf-8' 'http://localhost/jarvis-agent/n2fe/api/customer/50203/number/109591/history/plan' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'
{
   "error_string" : "",
   "username" : "su",
   "group_list" : "ACS_BOSS,BCD_BOSS,CCS Superuser",
   "logged_in" : "1",
   "success" : 1,
   "modified" : 1
}

DELETE /api/customer/:customerId/number/:serviceNumberId/history/:schedule_id/plan/:planId

Parameter Example Description
customer_id 3518 [URL parameter], [Required] The ID of the customer whose announcements are to be retrieved.
sn 1421525 [URL parameter], [Required] This must be the service number ID, not the service number itself.
schedule_id 2018132416548909491 [URL parameter], [Required] This is the id of the schedule being deleted.
planId 190760 [URL parameter], [Required] This is the id of the plan in the schedule.

Response Content

The response will be a JSON array of objects, with each object consisting of the following information.

Key Type Description
error_string String If the user is not logged in, or another error occurs, the error will be described in this field.
group_list String If authenticated this field will exist and provide a comma separate list of groups the user has been authenticated with.
logged_in Integer If 1, the user is logged in. If 0, the user is not logged in.
modified Boolean Indication of whether the schedule was modified successfully.
success Boolean The success status of the scheduling.
username String If authenticated this field will exist and privide the username the user is logged in with.

Examples

'http://localhost/jarvis-agent/n2fe/api/customer/50203/number/109491/history/2018132416548909491/plan/190760' -H 'Cookie: N2FE_CGISESSID=4876c530f3d7252330a95ea51007f252'

{
   "logged_in" : "1",
   "group_list" : "ACS_BOSS,BCD_BOSS,CCS Superuser",
   "error_string" : "",
   "modified" : 1,
   "success" : 1,
   "username" : "su"
}