Update activity travel statistics
/rest/ofscStatistics/v1/activityTravelStats
This operation updates the travel duration override for the travel keys that are currently active. However, it is possible to override the travel durations only at the company level and not at any of the lower levels.
The override value is stored in the application in addition to the statistically learned value. For travel duration estimates, if an override is specified, then the override value is used instead of the statistically learned value. However, the statistically learned value is kept updated based on new reported durations. At any point of time, it is possible to stop using the overrides by importing the data again with value 0 in the 'override' field. In such cases, the application starts using the statistically learned value for duration estimates. If a part of the key contains properties to be considered as case-insensitive, the value specified for that part of the key should be in smaller case in the API request.
Note:
This operation can be used only when the following conditions are satisfied:
- The customer must have a subscription to Oracle Field Service Professional or Enterprise Cloud Service.
- The required application must have permission to access the Statistics API. To grant the permission, navigate to Configuration, Applications screen. For the required application, click Add new in the API access section, and select Statistics API.
- If 'Detect activity travel keys automatically' is checked in Statistics configuration, then this API cannot be used.
Request
object
-
items(required):
array items
Minimum Number of Items:
1
Maximum Number of Items:10000
array
1
10000
-
Array of:
object activityTravelRequest
The individual items in the request array.
object
-
fkey(required):
string
Title:
From Key
Maximum Length:50
The travel key value corresponding to the source location of the travel. For example, 'SRT D3'. -
keyId:
integer
Title:
Key ID
Maximum Length:99999
Key ID of one of the configured travel keys.
- If 'keyId' is not specified, data corresponding to the default travel key will be updated.
- If 'keyId' is specified and if it exists in the system, data will be updated for the corresponding key.
- If 'keyId' is specified but does not exist in the system, an error message will be returned
-
override(required):
integer
Title:
Override
Minimum Value:0
Maximum Value:480
The override value that needs to be set for 'fkey' and 'tkey' combination. For example, 100. -
tkey(required):
string
Title:
To Key
Maximum Length:50
The travel key value corresponding to the destination location of the travel. For example, '11 AY'.
Response
- application/schema+json
- application/json
200 Response
object
-
status:
string
The HTTP status code.
-
updatedRecords:
integer
The number of records updated by the request.
409 Response
Default Response
object
-
detail:
string
The detailed description of this error.
-
status:
string
The HTTP status code of this error.
-
title(required):
string
The brief description of this error.
-
type(required):
string
The URL of the web page containing more details about this error.
Examples
The following example shows how to insert or update the travel duration override for travel keys by submitting a PATCH request on the REST resource using cURL:
cURL command Example
curl -X PATCH \ https://<instance_name>.fs.ocs.oraclecloud.com/rest/ofscStatistics/v1/activityTravelStats \ -u '<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>' \ -H 'content-type: application/json' \ -d '{ "items": [{ "keyId": "1", "fkey": "79765" , "tkey": "79765", "override":0 }, { "keyId": "2", "fkey": "79763" , "tkey": "79764", "override":10 }] }
Response Header Example
The following shows an example of the response header.
HTTP/1.1 200 OK Server: nginx/1.2.7 Date: Mon, 18 Dec 2017 02:20:33 GMT Content-Type: application/json; charset=utf-8
Response Body Example
The following shows an example of the response body in JSON format.
{ "status": "OK", "updatedrecords": 2 }