Bulk update resource work skills
/rest/ofscCore/v1/resources/custom-actions/bulkUpdateWorkSkills
This operation creates, updates, or deletes work skills 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 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 skills 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 skill does not exist or is invalid.
- The start date or end date is not specified or is invalid.
- The ratio is not specified or is invalid.
Error Messages
The following error messages are supported for this operation:
- Cannot set work skills for resource: 'resource2'
- Resource not found: resourceId='resource2'
- Only one of the parameters 'resourceId' or 'resourceInternalId' can be specified at one item of request
- Mandatory property is absent: 'resourceId' or 'resourceInternalId' must be defined
- Invalid property value. Path: '0/resourceId'. String is too long. Length: '%%'. Maximum valid length: '32'
- Invalid property value. Path: '0/resourceId'. String is too short. Length: '0'. Minimum valid length: '1'
- Invalid property value. Path: '0/workSkills/0/ratio'. Value: '%%'. Value is greater than maximum: '100'
- Invalid property value. Path: '%%%/workSkills/0/ratio'. Value: '-%%'. Value is less than minimum: '0'
- Invalid property value. Property: 'resourceId'. Value: '%%'
- Required property is not specified: '0/workSkills'
Permissions:
The permission 'core_api_resource' has to be set to 'ReadWrite' for this API to work.
Request
array
Bulk Update Work Skills Schema
-
Array of:
object Work Skill
Title:
Work Skill
An array of work skill objects. If the array is empty, then the currently assigned work skills are removed from the resource.
object
Work Skill
-
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
-
workSkills(required):
array Items
Title:
Items
An array of work skill items.
array
Items
-
Array of:
object Work Skill
Title:
Work Skill
object
Work Skill
-
endDate:
string
Title:
End Date
The date until when the work skill is effective. Specify the date in 'YYYY-MM-DD' format. -
ratio(required):
integer
Title:
Ratio
Minimum Value:0
Maximum Value:100
The skill level of the resource. -
startDate:
string
Title:
Start Date
The date when the work skill takes effect. Specify the date in 'YYYY-MM-DD' format. -
workSkill(required):
string
Title:
Work Skill Label
Maximum Length:40
The label of the work skill.
Response
- application/json
200 Response
object
Resource Work Skills Bulk Update Schema
-
resourcesUpdated:
integer
Title:
Resources Updated
The number of resources for which the work skills 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 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 skills. -
itemsFailed:
integer
Title:
Items Failed
The number of failed work skill updates. -
itemsUpdated:
integer
Title:
Items Updated
The number of work skills updated 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 skills 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/resources/custom-actions/bulkUpdateWorkSkills" -X POST -d ' [ { "resourceId": "resource1", "workSkills": [ { "workSkill": "IN", "ratio": 80, "startDate" : "2018-04-12", "endDate" : "2018-12-31" }, { "workSkill": "UPD", "ratio": 100, "startDate" : "2018-04-12", "endDate" : "2018-12-31" } ] }, { "resourceId": "resource2", "workSkills": [ { "workSkill": "IN", "ratio": 100, "startDate" : "2018-04-12", "endDate" : "2018-09-01" }, { "workSkill": "UPD", "ratio": 100, "startDate" : "2018-04-12", "endDate" : "2018-09-01" } ] }, { "resourceId": "155", "workSkills": [ { "workSkill": "IN", "ratio": 100, "startDate" : "2018-04-12", "endDate" : "2018-09-01" } ] }, { "resourceId": "resource3", "workSkills": [ { "workSkill": "IN", "ratio": 100, "startDate" : "2018-04-12", "endDate" : "2018-09-01" }, { "workSkill": "PINK", "ratio": 100, "startDate" : "2018-04-12", "endDate" : "2018-09-01" } ] } ]
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": 2, "itemsFailed": 0 }, { "resourceId": "resource2", "itemsUpdated": 2, "itemsFailed": 0 }, { "resourceId": "155", "itemsUpdated": 0, "itemsFailed": 1, "error": { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5", "title": "Not found", "status": "404", "detail": "Resource not found: resourceId='155'" } }, { "resourceId": "resource3", "itemsUpdated": 0, "itemsFailed": 1, "error": { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1", "title": "Bad request", "status": "400", "detail": "Invalid workSkill label \"PINK\"" } }] }