Get subscriptions
/rest/ofscCore/v1/events/subscriptions
Request
-
allSubscriptions: boolean
Contains one of the following values: true or false.
- If true, all subscriptions in the Oracle Field Service application are returned, even if the subscriptions are created by other applications.
- If false, then only the subscriptions created by other applications are returned.
The default value is false.
Response
- application/json
Default Response
array-
Array of:
object Subscription
Title:
SubscriptionThe array of subscriptions.
objectSubscription-
applicationId:
string
Title:
Application IDThe identifier of the application that has created the subscription. -
createdTime:
string
Title:
Created TimeThe time when the subscription was created in 'YYYY-MM-DD HH:MM:SS' (UTC) format. -
expirationTime:
string
Title:
Expiration TimeThe expiration time of the subscription in 'YYYY-MM-DD HH:MM:SS' (UTC) format. -
subscriptionId:
string
Title:
Subscription IDThe identifier of the subscription.
-
object
Subscription
Title:
SubscriptionThe schema of the response body object for this operation.
objectSubscription-
subscriptionConfig:
array Subscription Config
Title:
Subscription ConfigThe list of subscription config elements used to filter the required events. -
subscriptionTitle:
string
Title:
Subscription TitleMinimum Length:1Maximum Length:255The title of the subscription. It can be used to distinguish a specific subscription from the other subscriptions. The field is optional and need not be unique.
arraySubscription Config-
Array of:
object Subscription Configuration Items
Title:
Subscription Configuration ItemsThe array of subscription config item used to filter the events. For example, a config item can be used to filter activity events whereas another config item can be used to filter inventory events through the same subscription.
objectSubscription Configuration Items-
events(required):
array List of events
Title:
List of eventsThe list of subscribed events.The following events are supported: activityCreated, activityUpdated, activityStarted, activityTravelStarted, activityTravelStopped, activitySuspended, activityCompleted, activityNotDone, activityCanceled, activityDeleted, activityDelayed, activityReopened, activityPreworkCreated, activityLinkCreated, activityLinkDeleted, resourcePreferenceCreated, resourcePreferenceDeleted, requiredInventoryCreated, requiredInventoryUpdated, requiredInventoryDeleted, inventoryInstalled, inventoryDeinstalled, customerInventoryCreated, customerInventoryUpdated, customerInventoryDeleted, inventoryUndoInstall, inventoryUndoDeinstall, activityMoved, routeCreated, routeUpdated, routeActivated, routeDeactivated, routeReactivated, customerRequestCreated, inventoryRequestCreated, resourceRequestCreated, chatMessageSent, chatUpdated, broadcastStatusUpdate, transactionUpdated, userCreated, userUpdated, userDeleted, resourceCreated, resourceUpdated, routingRun, formSubmitted.
-
fields:
array Subscription Field List
Title:
Subscription Field ListThe list of fields and custom properties included in the event. The fields are added to the 'activityDetails' element for activity events, 'inventoryDetails' element for inventory events, and to the 'resourceDetails' element for the resource events.- The field names of the activity events are same as the field names retrieved from the 'Get activity' operation.
- The field names of the inventory events are the same as the field names retrieved from the 'Get inventory' operation.
- The field names of the resource events are the same as the field names retrieved from the 'Get resource' operation.
- The field names of the user events are the same as the field names retrieved from the 'Get user' operation.
Also, custom property labels can be specified along with the field names. Note that events API doesn't support file properties and has a limitation 5 kb for the maximum length of a custom property text. If some value exceeds this size and it should be present in the event, it will be truncated down to 5 kb and a warning message will be added at the end of the truncated value "TRUNCATED: Property value was > 5KB - too long to be published in full". Therefore, if no specific fields are specified, then by default only the changed and key fields are returned.
The following events are supported:
- Activity events
- Inventory events
- Resource events
- User events
The 'activityDeleted' event will not contain the specified 'country_code' field and the specified custom activity properties.
Note: The list of fields cannot be different for the same event type within one subscription. If a subscription has several configurations in which same event type is present but with different "fields" specified, the event of that type will be generated with merged list of fields.
-
filterExpression:
string
Title:
Filter ExpressionThe filter expression applied to the events. Only events matching the specified filter expression are added to the subscription.
The following events are supported:
- All activity events
- All inventory events
- All resource events
- All user events
Filter Expression Rules
- Filter expression is specified as a single string.
- It should evaluate to a boolean expression.
- It should contain 1 or more comparison statements.
- Syntax of comparison statements: field operator value, for example,activityDetails.activityType == 'Install'.
- The order cannot be changed. Therefore, ('Install' == activityDetails.activityType) is not valid.
- The comparison between fields, (A == B) or between values, (1 == 1) is also not valid.
- The field has to be an alphanumeric identifier with no spaces or special characters, except underscore. Subfields are separated by dot (.) Examples:
- activityDetails.activityType
- activityDetails.X_MYPROP_10
- user
- field.subField
- Comparison operators:
- <
- >
- <=
- >=
- ==
- !=
- in
- Value can either be a string literal, an integer literal, or an array literal of strings and integers.
- String literals are delimited by single quotes, with escape character ~, for example:
- str == 'My String'
- str == 'My string with ~' a quote inside'
- Integer literals are without quotes, may not contain dot, or leading zeroes. For example:
- num == 0
- num == 12345
- num == -67/li>
- Array literals should only contain strings or integers and should have square brackets. Empty arrays are not allowed. Arrays are only allowed after the "in" operator.
- enum in [1,2,3]
- enum in ['Abc','Def','Ghi']
- String literals are delimited by single quotes, with escape character ~, for example:
- String comparisons are valid:
- date > '2015-06-02'
- String comparisons are case-insensitive:
- name == 'john.smith' is the same as name == 'JOHN.SMITH'
- String to integer coercion is valid:
- num == -123 is the same as num == '-123'
- Multiple comparison statements have to be separated by logical operator and/or.
- A == 1 and B == 2 or C == 3
- A == 'xx' or A == 'yy'
- Operator precedence:
- comparison operators: ==, !=, <, >, <=, >=, in
- 'not'
- 'and', 'or'
- Logical operators ('and' / 'or') have the same precedence, so parentheses can be used to achieve precedence.
- A == 1 and (B == 2 or C == 3)
- Operators are also case-insensitive:
- (num IN [1,2,3]) OR (num < 0)
- Any statement can be preceded by "not" operator to negate it.
- not (activityType in ['IN','TC','BR'])
- A == 1 and not ( B == 2 or B == 3 )
-
Whitespace outside strings is ignored.
- When the field being compared does not exist in the event or is null, then it evaluates to empty string. For example, expressions (non_existent_field == ''), (null_field == '').
-
monitorChanges:
array Subscription Monitor Changes List
Title:
Subscription Monitor Changes ListThe list of fields for which the changes need to be tracked. If the 'monitorChanges' parameter is specified, then the event is only published to the subscription, if any of the fields listed in the parameter are changed. The valid values for the field depend on the value specified in the 'events' field.- If the activity events are specified in the 'events' field, then only the field names of the Activity object are returned.
- If the inventory events are specified in the 'events' field, then only the field names of the Inventory object are returned.
- If the resource events are specified in the 'events' field, then only the field names of the Resource object are returned.
- If the user events are specified in the 'events' field, then only the field names of the User object are returned.
- Custom property labels can also be specified along with the field names. Note that events API doesn't support file properties and has a limitation 5 kb for the maximum length of a custom property text. If some value exceeds this size and it should be present in the event, it will be truncated down to 5 kb and a warning message will be added at the end of the truncated value "TRUNCATED: Property value was > 5KB - too long to be published in full".
The following events are supported:
- Activity events
- Inventory events
- Resource events
- User events
arrayList of eventsThe following events are supported: activityCreated, activityUpdated, activityStarted, activityTravelStarted, activityTravelStopped, activitySuspended, activityCompleted, activityNotDone, activityCanceled, activityDeleted, activityDelayed, activityReopened, activityPreworkCreated, activityLinkCreated, activityLinkDeleted, resourcePreferenceCreated, resourcePreferenceDeleted, requiredInventoryCreated, requiredInventoryUpdated, requiredInventoryDeleted, inventoryInstalled, inventoryDeinstalled, customerInventoryCreated, customerInventoryUpdated, customerInventoryDeleted, inventoryUndoInstall, inventoryUndoDeinstall, activityMoved, routeCreated, routeUpdated, routeActivated, routeDeactivated, routeReactivated, customerRequestCreated, inventoryRequestCreated, resourceRequestCreated, chatMessageSent, chatUpdated, broadcastStatusUpdate, transactionUpdated, userCreated, userUpdated, userDeleted, resourceCreated, resourceUpdated, routingRun, formSubmitted.
-
Array of:
string
Title:
Event TypeAllowed Values:[ "activityCreated", "activityUpdated", "activityStarted", "activityTravelStarted", "activityTravelStopped", "activitySuspended", "activityCompleted", "activityNotDone", "activityCanceled", "activityDeleted", "activityDelayed", "activityReopened", "activityPreworkCreated", "activityLinkCreated", "activityLinkDeleted", "resourcePreferenceCreated", "resourcePreferenceDeleted", "requiredInventoryCreated", "requiredInventoryUpdated", "requiredInventoryDeleted", "inventoryInstalled", "inventoryDeinstalled", "customerInventoryCreated", "customerInventoryUpdated", "customerInventoryDeleted", "inventoryUndoInstall", "inventoryUndoDeinstall", "activityMoved", "routeCreated", "routeUpdated", "routeActivated", "routeDeactivated", "routeReactivated", "customerRequestCreated", "inventoryRequestCreated", "resourceRequestCreated", "chatUpdated", "chatMessageSent", "userUpdated", "userCreated", "userDeleted", "resourceUpdated", "resourceCreated", "transactionUpdated", "resourceInventoryCreated", "resourceInventoryUpdated", "resourceInventoryDeleted", "routingRun", "broadcastStatusUpdate", "formSubmitted" ]The type of the event.
arraySubscription Field List- The field names of the activity events are same as the field names retrieved from the 'Get activity' operation.
- The field names of the inventory events are the same as the field names retrieved from the 'Get inventory' operation.
- The field names of the resource events are the same as the field names retrieved from the 'Get resource' operation.
- The field names of the user events are the same as the field names retrieved from the 'Get user' operation.
Also, custom property labels can be specified along with the field names. Note that events API doesn't support file properties and has a limitation 5 kb for the maximum length of a custom property text. If some value exceeds this size and it should be present in the event, it will be truncated down to 5 kb and a warning message will be added at the end of the truncated value "TRUNCATED: Property value was > 5KB - too long to be published in full". Therefore, if no specific fields are specified, then by default only the changed and key fields are returned.
The following events are supported:
- Activity events
- Inventory events
- Resource events
- User events
The 'activityDeleted' event will not contain the specified 'country_code' field and the specified custom activity properties.
Note: The list of fields cannot be different for the same event type within one subscription. If a subscription has several configurations in which same event type is present but with different "fields" specified, the event of that type will be generated with merged list of fields.
-
Array of:
string
Title:
Field
arraySubscription Monitor Changes List- If the activity events are specified in the 'events' field, then only the field names of the Activity object are returned.
- If the inventory events are specified in the 'events' field, then only the field names of the Inventory object are returned.
- If the resource events are specified in the 'events' field, then only the field names of the Resource object are returned.
- If the user events are specified in the 'events' field, then only the field names of the User object are returned.
- Custom property labels can also be specified along with the field names. Note that events API doesn't support file properties and has a limitation 5 kb for the maximum length of a custom property text. If some value exceeds this size and it should be present in the event, it will be truncated down to 5 kb and a warning message will be added at the end of the truncated value "TRUNCATED: Property value was > 5KB - too long to be published in full".
The following events are supported:
- Activity events
- Inventory events
- Resource events
- User events
-
Array of:
string
Title:
Field To Monitor
Examples
The following example shows how to get list of subscriptions by submitting a GET request on the REST resource.
Example of Request Header
The following shows an example of the response header.
GET /rest/ofscCore/v1/events/subscriptions Connection: close Accept-Encoding: gzip,deflate Authorization: Basic bXlyb290QHFhNTUwMzox Host: <instance_name>.fs.ocs.oraclecloud.com
Example of Response Header
The following shows an example of the response header.
HTTP/1.1 200 OK Server: nginx Date: Mon, 25 Apr 2016 12:36:21 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: close
Example of Response Body
The following example shows the contents of the response body in JSON format.
{
"items" : [
{
"subscriptionId" : "356a192b7913b04c54574d18c28d46e6395428ab",
"subscriptionTitle" : "My first subscription",
"applicationId" : "middleware1",
"createdTime" : "2017-05-04 07:39:19",
"expirationTime" : "2017-05-05 17:39:19",
"subscriptionConfig" : [
{
"events" : ["activityUpdated"],
"filterExpression" : "not (activityType in ['IN','TC','BR']) and (event.user != 'ics_integ') and customerName != ''"
}
]
},
{
"subscriptionId" : "da4b9237bacccdf19c0760cab7aec4a8359010b0",
"subscriptionTitle" : "My second subscription",
"applicationId" : "middleware1",
"createdTime" : "2017-05-04 07:39:19",
"expirationTime" : "2017-05-05 17:39:19",
"subscriptionConfig" : [
{
"events" : ["activitycompleted"],
"fields" : ["firstManualOperationUser", "endTime"]
}
]
}
]
}