Update activity travel statistics

patch

/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 system 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 system starts using the statistically learned value for duration estimates.

Note:

  • When the Statistics API is used to make travel duration changes, the changes are reflected for all future travels in the application only after the next run of the statistics agent. The statistics agent is run once a day, usually in the early morning hours.
  • The limit for each API request is 10000 records. To update more records, multiple requests can be used.
  • The following error messages are supported for the HTTP Code 400 response on this operation:

    • Maximum number of resource data exceeded. Limit 10000
    • Invalid structure. Items tag missing
    • Invalid structure. <fkey|tkey|override> tag missing
    • Property <fkey|tkey|override> value not set
    • Property override value should not be negative
    • Property override value should not be greater than 480
    • Property <fkey|tkey> value length should not exceed 50

    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.

    Request

    Body ()
    This section describes the request body parameters for this operation.
    Root Schema : activityTravelRequestList
    Type: object
    The schema of the request body object for this operation.
    Show Source
    Nested Schema : items
    Type: array
    Show Source
    Nested Schema : activityTravelRequest
    Type: object
    The individual items in the request array.
    Show Source
    • Title: From Key
      The travel key value corresponding to the source location of the travel. For example, 'SRT D3'.
    • Title: Override
      The override value that needs to be set for 'fkey' and 'tkey' combination. For example, 100.
    • Title: To Key
      The travel key value corresponding to the destination location of the travel. For example, '11 AY'.
    Back to Top

    Response

    Supported Media Types

    200 Response

    This section describes the 200 status response for this operation.
    Body ()
    Root Schema : activityTravelPatchResponse
    Type: object
    Show Source
    Nested Schema : results
    Type: object
    Show Source

    Default Response

    This section describes the default error response for this operation.
    Body ()
    Root Schema : Error
    Type: object
    Error response
    Show Source
    Back to Top

    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>.etadirect.com/rest/ofscStatistics/v1/activityTravelStats \
      -u '<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>' \
      -H 'content-type: application/json' \
      -d '{
    	"items": [{
        	"fkey": "79765" ,
            "tkey": "79765",
            "override":0
       },
       {
           "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
    }
    
    Back to Top