Bulk update resource work zones
/rest/ofscCore/v1/resources/custom-actions/bulkUpdateWorkZones
This operation creates, updates, or deletes work zones of multiple resources in a single call. If there are no existing work zones for the resource, then the operation creates the work zones specified in the request. If there are work zones already existing for the resource, then the operation replaces them with the work zones specified in the request.
Error Handling:
- If the request size is greater than 5 MB, then the operation fails with the HTTP status '413 Request entity too large' error.
- If the swagger validation fails, then the operation fails with the HTTP status '400 Bad Request' error. Examples of such cases are:
- A required field is not specified.
- The request is not a valid JSON.
- The operation returns HTTP status '200 OK', even if some work zones are not updated or some resources specified in the request are invalid. Verify the response to identify the operations that succeeded and the operations that failed. Examples of such cases are:
- The resource ID does not exist.
- The work zone does not exist or is invalid.
- The start date or end date is not specified or is invalid.
Permissions:
The permission 'core_api_resource' has to be set to 'ReadWrite' for this API to work.
Request
array
Bulk Update Work Zones Schema
-
Array of:
object Work Zone
Title:
Work Zone
object
Work Zone
-
resourceId:
string
Title:
Resource ID
Minimum Length:1
Maximum Length:32
The identifier of the resource in the external system.Note: Only one of the following properties must be specified:
- resourceId
- resourceInternalId
-
resourceInternalId:
integer
Title:
Resource Internal ID
Minimum Value:1
The unique identifier of the resource in Oracle Field Service.Note: Only one of the following properties must be specified:
- resourceId
- resourceInternalId
-
workZones(required):
array Items
Title:
Items
An array of work zone items.
array
Items
-
Array of:
object Work Zone
Title:
Work Zone
object
Work Zone
-
endDate:
string
Title:
End Date
The date until when the work zone assignment is effective. Specify the date in 'YYYY-MM-DD' format. -
ratio:
integer
Title:
Ratio
Minimum Value:1
Maximum Value:100
The work zone ratio of the resource. The default value is 100. -
recurEvery:
integer
Title:
Recur Every
Minimum Value:1
Maximum Value:10000
The time between each recurrence of the work zone assignment. Depending on the value selected for 'recurrence', the value of the parameter indicates the time between recurrence in days or weeks. For example, if '4' is the value of this parameter, and the 'recurrence' is 'daily', it indicates that the time between each recurrence is four days. -
recurrence:
string
Title:
Recurrence
Allowed Values:[ "weekly", "daily" ]
The value of this parameter along with the 'Recur Every' parameter defines the time between each recurrence of the work zone assignment. For example, if you specify 'daily' as the value of this parameter and '4' as the value of the 'recurEvery' parameter, then the time between each recurrence is four days. -
startDate(required):
string
Title:
Start Date
The date when the work zone assignment takes effect. Specify the date in 'YYYY-MM-DD' format. -
type:
string
Title:
Type
Allowed Values:[ "regular", "override" ]
The type of the work zone assignment. -
weekdays:
array Weekdays
Title:
Weekdays
Unique Items Required:true
The weekdays on which the work zone is assigned to the resources. This parameter is mandatory when the recurrence is weekly. -
workZone(required):
string
Title:
Work Zone Label
Maximum Length:255
The identifier of the work zone. -
workZoneItemId:
integer
Title:
Work Zone Item ID
The identifier of the work zone assignment.
array
Weekdays
true
-
Array of:
string
Allowed Values:
[ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
Response
- application/json
200 Response
object
Resource Work Zones Bulk Update Schema
-
resourcesUpdated:
integer
Title:
Resources Updated
The number of resources for which the work zones are updated. -
results:
array Results
Title:
Results
An array containing the results of the operation. The items in this array are in the same order as the items in the resources array. Each item in the resources array of the request has a corresponding item in the results array.
array
Results
-
Array of:
object items
An object containing a single result item.
object
-
error:
object Error
Title:
Error
The errors that occurred while updating the work zones. -
itemsFailed:
integer
Title:
Items Failed
The number of failed work zone updates. -
itemsUpdated:
integer
Title:
Items Updated
The number of work zones updated for the resource. -
resourceId:
string
Title:
Resource ID
The unique identifier of the resource in Oracle Field Service.
object
Error
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.
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 bulk update resource work zones by submitting a POST request on the REST resource using cURL:
cURL command Example
curl -s -u "<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>" --url "https://<instance_name>.fs.ocs.oraclecloud.com/rest/ofscCore/v1/resources/custom-actions/bulkUpdateWorkZones" -X POST -d ' [ { "resourceId":"test_tech", "workZones":[ { "workZone": "GENEVA", "startDate": "2015-09-16", "endDate": "2015-09-18", "ratio": 100, "weekdays": [ "Tue", "Sat" ], "recurrence": "weekly" }, { "workZone": "GENEVA", "startDate": "2015-09-16", "endDate": "2015-09-18", "ratio": 100, "weekdays": [ "Tue", "Sat" ], "recurrence": "weekly" }, { "workZone": "GENEVA", "startDate": "2015-09-16", "endDate": "2015-09-18", "ratio": 100, "weekdays": [ "Tue", "Sat" ], "recurrence": "weekly" } ] } ]'
Response Header Example
The following shows an example of the response header.
HTTP/1.1 200 OK Server: nginx/1.2.7 Date: Wed, 27 Jun 2018 12:44:50 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive
Response Body Example
The following shows an example of the response body in JSON format.
{ "resourcesUpdated" : 2, "results" : [ { "resourceId": "resource1", "itemsUpdated" : 3, "itemsFailed": 1, "errors": [ { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1", "title": "Bad request", "status": "400", "detail": "Invalid value of element: 'startDate'. Value: 'incorrect'. Value must be a date of form 'YYYY-MM-DD'." }, { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1", "title": "Bad Request", "status": "400", "detail": "Required property not set. Entity: Resource Work Zones, Property: workZone" }, ] }, { "resourceId": "resource2", "itemsUpdated" : 0, "itemsFailed": 1, "errors":[{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1", "title": "Bad request", "status": "400", "detail": "Invalid property value. Property: 'workZone'. Value: 'incorrect'. Valid values: ...." }] }, { "resourceId": "resource3", "itemsUpdated" : 3, "itemsFailed": 0 } ] }