Routing Events

The following routing event can be specified as part of the request for creating a subscription:

Event Description

routingRun

This event type allows integrators to build flows depending on the routing execution stages and reduces the necessity to watch and monitor routing execution processes in the Manage interface.

An external system can subscribe to the new event type using the 'Create subscription' function. Additionally, the subscribing application can use the 'filterExpression' field to narrow the event scope depending on the flow.

Note:

The 'fields' parameter for the 'Create subscription' function for this event type will not affect the response of the 'Get events' function.

Event Fields

The routing event contains the following fields:

  • eventType (string): The type of the event. For this event, the value is 'routingRun'.
  • time (string): The time of the event in UTC time zone. The time format is YYYY-MM-DD HH:MM:SS.
  • user (string):
    • When routing is started manually by the user, the value is the login value of the user who started it.
    • When routing is started automatically, the value is an empty string.
  • applicationId (string):
    • When routing is started manually by the user, the value is an empty string.
    • When routing is started automatically, the value is the string constant 'AUTOMATIC_ROUTING'.
  • routingRunDetails: This object contains the following fields:
    • targetDate (string): The date for which the activities are routed. The format is 'YYYY-MM-DD'.
    • numberOfDays (int): For a single day routing, the value is 1. For multi-day routing, the value is the number of days routed, starting from 'targetDate' and going into the future.
    • resourceId (string): The external ID of the routing bucket.
    • startType (string): Can contain one of the following values:
      • When routing is started automatically on schedule, the value is 'automatic'.
      • When routing is started manually from the GUI by the user, the value is 'manual'.
    • result (string): The result of the routing execution. Can contain one of the following values:
      • When the routing is executed successfully, and some activities are moved as a result, the value is 'succeeded'.
      • When the routing execution is stopped by the user, the value is 'stopped'.
      • When the routing execution fails, the value is 'failed'.
    • message (string): The field contains the error message.
      • When 'result' is 'succeeded' and 'activitiesRouted' is 0, it contains the explanation of why no activities were routed.
      • When 'result' is 'failed', it contains the error description.
      • In all other cases it contains an empty string.
    • routingRunId (int): The unique ID of the specific routing execution.
    • routingPlan (string): The name of the routing plan that was executed. It is not unique.
    • routingPlanId (int): The unique ID of the routing plan that was executed.
    • routingProfile (string): The name of the routing profile that the routing plan belongs to. It is not unique.
    • routingProfileId (int): The unique ID of the routing profile that the routing plan belongs to.
    • routingRunDuration (int): The duration (in seconds) of the routing run.
    • activitiesMatched (int): The number of activities that matched the routing plan filters.
    • activitiesRouted (int): The number of activities scheduled and assigned by the routing run.
    • activitiesNotRouted (int): The number of activities that matched the routing plan filters but were not routed.
    • resourcesMatched (int): The number of resources that matched the routing plan filters.
    • resourcesUsed (int): The number of resource that were assigned activities by the routing run.
    • averageWorkingTime (int): The average working time of the resources.
    • averageOvertime (int): The average overtime time of the resources.
    • averageTravelTime (int): The average travel time of the resources.
    • averageDowntime (int): The average downtime time of the resources.

Examples

The following is an example for creating subscription with event type 'routingRun':

cURL Command


POST https://<instance_name>.etadirect.com/events/subscriptions

{
     "subscriptionConfig":[
         {
             "events" : [
                 "routingRun"
             ]
             ,"filterExpression" : "routingRunDetails.routingPlan=='Bulk 
Routing'"
         }
     ]
}

Response

HTTP/1.1 200 OK

{
     "subscriptionId": "50bb8eb8f0cf12145f325a31b40cc15906a67bd2",
     "nextPage": "180404-706,0",
     "links": [
         {
             "rel": "describedby",
             "href": 
"https://<instance_name>.etadirect.com/rest/ofscCore/v1/metadata-catalog/events"
         },
         {
             "rel": "canonical",
             "href": 
"https://<instance_name>.etadirect.com/rest/ofscCore/v1/events/subscriptions/50bb8eb8f0cf12145f325a31b40cc15906a67bd2"
         },
         {
             "rel": "data",
             "href": 
"https://<instance_name>.etadirect.com/rest/ofscCore/v1/events/?subscriptionId=50bb8eb8f0cf12145f325a31b40cc15906a67bd2&page=180404-706,0"
         }
     ]
}

The following is an example of 'Get events' call for a event subscription that has event type as 'routingRun':

Request

GET 
https://<instance_name>.etadirect.com/rest/ofscCore/v1/events/?subscriptionId=50bb8eb8f0cf12145f325a31b40cc15906a67bd2&page=180404-706,0

Response

HTTP/1.1 200 OK

{
     "found": true,
     "nextPage": "180404-706,1",
     "items": [
         {
             "eventType": "routingRun",
             "time": "2018-04-04 21:10:33",
             "user": "admin",
             "routingRunDetails": {
                 "routingPlan": "Bulk Routing",
                 "routingPlanId": 1,
                 "result": "succeeded",
                 "startType": "manual",
                 "type": "routing",
                 "resourceId": 1000000,
                 "routingRunId": 27023,
                 "targetDate": "2018-04-04",
                 "numberOfDays": 1,
                 "routingProfile": "Routing (Region 3-5)",
                 "routingProfileId": 1,
                 "routingRunDuration": 2,
                 "activitiesMatched": 11,
                 "activitiesRouted": 0,
                 "activitiesNotRouted": 11,
                 "resourcesMatched": 97,
                 "resourcesUsed": 1,
                 "averageWorkingTime": 104,
                 "averageOverTime": 224,
                 "averageTravelTime": 120,
                 "averageDownTime": 0
             }
         }
     ],
     "links": [
         {
             "rel": "describedby",
             "href": 
"https://<instance_name>.etadirect.com/rest/ofscCore/v1/metadata-catalog/events"
         },
         {
             "rel": "canonical",
             "href": 
"https://<instance_name>.etadirect.com/rest/ofscCore/v1/events/?subscriptionId=50bb8eb8f0cf12145f325a31b40cc15906a67bd2&page=180404-706,0"
         },
         {
             "rel": "next",
             "href": 
"https://<instance_name>.etadirect.com/rest/ofscCore/v1/events/?subscriptionId=50bb8eb8f0cf12145f325a31b40cc15906a67bd2&page=180404-706,1"
         }
     ]
}