Bulk update resource work schedules
/rest/ofscCore/v1/resources/custom-actions/bulkUpdateWorkSchedules
This operation creates, updates, or deletes work schedules of multiple resources in a single call.
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 request body in JSON is invalid in terms of the swagger schema, then the operation fails with the HTTP status '400 Bad Request' error. The error details are as follows:
- Invalid property value. Path: 'path_in_swagger_shema'. Value: 'error_value'. Valid values: 'some_valid_value_1','some_valid_value_N'.
- If both the parameters 'resourceId' and 'resourceInternalId' are specified in a request, then the operation fails with the HTTP status '400 Bad Request' error. The error details are as follows:
- Only one of the parameters 'resourceId' or 'resourceInternalId' can be specified in a request.
- If the parameters 'resourceId' and 'resourceInternalId' are missing in the request item, then the operation fails with the HTTP status '400 Bad Request' error. The error details are as follows:
- Mandatory property is absent: 'resourceId' or 'resourceInternalId' must be defined.
- 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 schedules 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. The following is an example of such case:
- The resourceId does not exist.
Permissions:
The permission 'core_api_resource' has to be set to 'ReadWrite' for this API to work.
Request
array
Bulk Update Resource Work Schedules Schema
-
Array of:
object Work Schedule
Title:
Work Schedule
An object containing a work schedule item.
object
Work Schedule
-
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
-
workSchedules(required):
array Items
Title:
Items
An array of work schedule items.
array
Items
-
Array of:
object Resource Work Schedule Item
Title:
Resource Work Schedule Item
The array of work schedule item of the resource.
object
Resource Work Schedule Item
-
comments:
string
Title:
Comments
The description of the schedule in Oracle Field Service. -
endDate:
string(date)
Title:
End Date
The date when this schedule ends. The date is in 'YYYY-MM-DD' format. -
isWorking:
boolean
Title:
Is Working Shift
Contains one of the following values: true or false. If true, then it is a working day. If false, then it is a non-working day.This is a read-only field calculated based on the record type or the shift settings.
-
nonWorkingReason:
string
Title:
Non-working Reason
The reason for the non-working day (for example, holiday, vacation). These reasons are preconfigured in the Oracle Field Service UI. -
points:
integer
Title:
Points
The units of labor per day when this schedule is in effect. This property may be empty because all the customers may not use it. -
recordType(required):
string
Title:
Record Type
Allowed Values:[ "schedule", "shift", "extra_shift", "working", "extra_working", "non-working" ]
The type of work schedule record. -
recurrence:
object Recurrence
Title:
Recurrence
An array containing recurring work schedule items. This object is optional when the recordType is schedule. And it is mandatory when the recordType is shift, extra_shift, working, extra_working or non-working -
scheduleItemId:
integer
Title:
Work Schedule Item ID
The identifier of the work schedule item in Oracle Field Service. -
scheduleLabel:
string
Title:
Work Schedule Label
The label of the work schedule in Oracle Field Service. This property is only available if the record type is schedule. -
scheduleShifts:
array Shifts
Title:
Shifts
The list of work shifts present in this work schedule. The properties of the work shifts are for information purpose only and cannot be modified using this operation. -
shiftLabel:
string
Title:
Work Shift Label
The label of the work shift in Oracle Field Service. This property is only available if the value of recordType is either shift or extra_shift. -
shiftType:
string
Title:
Shift Type
Allowed Values:[ "regular", "on-call" ]
The type of the work shift. -
startDate(required):
string(date)
Title:
Start Date
The date when this schedule takes effect. The format is 'YYYY-MM-DD'. -
workTimeEnd:
string(time)
Title:
Work Time End
The end time of the working day when this schedule is in effect. The format is 'HH:MM'. This property is not available if the value of the isWorking parameter is false. -
workTimeStart:
string(time)
Title:
Work Time Start
The start time of the working day when this schedule is in effect. The format is 'HH:MM'. This property is not available if the value of the isWorking parameter is false.
object
Recurrence
-
dayFrom:
string
Title:
Day From
The start day (in 'YYYY-MM-DD' format) of the schedule period applicable for each year, when the schedule is in effect. It is used only if the recurrence type is yearly. -
dayTo:
string
Title:
Day To
The end day (in 'YYYY-MM-DD' format) of the schedule period applicable for each year, when the schedule is in effect. It is used only if the recurrence type is yearly. -
recurEvery:
integer
Title:
Recur Every
Minimum Value:1
Maximum Value:255
The time between each recurrence of the work schedule. 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. -
recurrenceType(required):
string
Title:
Recurrence Type
Allowed Values:[ "daily", "weekly", "yearly", "everyday" ]
The type of the recurrence. This property along with the 'recurEvery' property defines the time between each recurrence. For example, if the value of this property is 'daily' and the value of the property 'recurEvery' is '4', then the time between each recurrence is four days. -
weekdays:
array Recurrence Weekdays
Title:
Recurrence Weekdays
The weekdays on which the work shift recurs.
array
Shifts
-
Array of:
object Resource Shift Item
Title:
Resource Shift Item
An object containing the resource shift item.
array
Recurrence Weekdays
-
Array of:
string
Title:
Weekday
Allowed Values:[ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
The weekday on which the work shift recurs. This field is required only if the recurrence type is weekly.
object
Resource Shift Item
-
comments:
string
Title:
Comments
The description of this shift in Oracle Field Service. -
endDate:
string(date)
Title:
End Date
The date when this shift ends. The date is in 'YYYY-MM-DD' format. -
isWorking:
boolean
Title:
Is Working Shift
Contains one of the following values: true or false. If true, then it is a working day. If false, then it is a non-working day.This is a read-only field calculated based on the record type or the shift settings.
-
nonWorkingReason:
string
Title:
Non-working Reason
The reason for the non-working day (for example, holiday, vacation). These reasons are preconfigured in the Oracle Field Service UI. -
points:
integer
Title:
Points
The units of labor per day when this schedule is in effect. This property may be empty because all the customers may not use it. -
recordType:
string
Title:
Record Type
Allowed Values:[ "shift", "extra_shift" ]
The type of the work shift record. -
recurrence:
object Recurrence
Title:
Recurrence
An array containing recurring work schedule items. For repeating shifts this property contains a description of how the shift repeats over time. -
scheduleItemId:
integer
Title:
Work Schedule Item ID
The identifier of the work schedule item in Oracle Field Service. -
scheduleLabel:
string
Title:
Work Schedule Label
The label of the work schedule in Oracle Field Service. This property is only available for the record type schedule. -
shiftLabel:
string
Title:
Work Shift Label
The label of the work shift in Oracle Field Service. This property is only available if the record type is either shift or extra_shift. -
shiftType:
string
Title:
Shift Type
Allowed Values:[ "regular", "on-call" ]
The type of the work shift. -
startDate:
string(date)
Title:
Start Date
The date when this shift takes effect. The date is in 'YYYY-MM-DD'. -
workTimeEnd:
string(time)
Title:
Work Time End
The end time of a working day when this work shift is in effect. The format is HH:MM. This property is not available if the value of the isWorking parameter is false. -
workTimeStart:
string(time)
Title:
Work Time Start
The start time of a working day when this work shift is in effect. The format is HH:MM. This property is not available if the value of the isWorking parameter is false.
object
Recurrence
-
dayFrom:
string
Title:
Day From
The start day (in 'YYYY-MM-DD' format) of the schedule period applicable for each year, when the schedule is in effect. It is used only if the recurrence type is yearly. -
dayTo:
string
Title:
Day To
The end day (in 'YYYY-MM-DD' format) of the schedule period applicable for each year, when the schedule is in effect. It is used only if the recurrence type is yearly. -
recurEvery:
integer
Title:
Recur Every
Minimum Value:1
Maximum Value:255
The time between each recurrence of the work shift. 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. -
recurrenceType:
string
Title:
Recurrence Type
Allowed Values:[ "daily", "weekly", "yearly", "everyday" ]
The type of the recurrence. This property along with the 'recurEvery' property defines the time between each recurrence. For example, if the value of this property is 'daily' and the value of the property 'recurEvery' is '4', then the time between each recurrence is four days. -
weekdays:
array Recurrence Weekdays
Title:
Recurrence Weekdays
The weekdays on which the work schedule recurs.
array
Recurrence Weekdays
-
Array of:
string
Title:
Weekday
Allowed Values:[ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
The weekday on which the work schedule recurs.
Response
- application/json
200 Response
object
Resource Work Schedules Bulk Update Schema
-
resourcesUpdated:
integer
Title:
Resources Updated
The number of resources for which the work schedules are updated. -
results:
array Results
Title:
Results
An array containing the results of the operation.
array
Results
-
Array of:
object Result Item
Title:
Result Item
An object containing a single result item.
object
Result Item
-
errors:
array Errors
Title:
Errors
The errors that occurred while updating the work schedules of resources. -
itemsFailed:
integer
Title:
Items Failed
The number of failed work schedule updates. -
itemsUpdated:
integer
Title:
Items Updated
The number of updated work schedules for the resource. -
resourceId:
string
Title:
Resource ID
The unique identifier of the resource in Oracle Field Service.
array
Errors
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 schedules 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/bulkUpdateWorkSchedules" -X POST -d '[ { "resourceId": "test_bucket", "workSchedules": [ { "recordType": "working", "startDate": "2018-04-16", "endDate": "2018-04-17", "workTimeStart": "10:00:00", "workTimeEnd": "22:00:00", "shiftType": "regular", "recurrence": { "recurrenceType": "weekly", "recurEvery": 5 }, "comment": "default test_bucket resources work schedule" }, { "recordType": "schedule", "startDate": "2018-04-16", "endDate": "2018-04-17", "scheduleLabel": "On-call+2nd" }, { "startDate": "2018-04-16", "endDate": "2018-04-17", "recordType": "non-working", "scheduleLabel": "On-call+2nd", "nonWorkingReason": "day-off" }, { "recordType": "schedule", "startDate": "2018-04-16", "endDate": "2018-04-17", "scheduleLabel": "PAR-2nd/ODD-1st" } ] }, { "resourceId": "test_tech", "workSchedules": [ { "startDate": "2018-04-16", "endDate": "2018-04-17", "recordType": "schedule", "scheduleLabel": "PAR2nd/ODD-1st" } ] } ]'
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" : 1, "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 schedule label \"PAR2nd/ODD-1st\"" }, { "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 Schedule, Property: shiftType" } ] }, { "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 schedule label \"PAR2nd/ODD-1st\"" }] }, { "resourceId": "resource3", "itemsUpdated" : 3, "itemsFailed": 0 } ] }