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
arrayBulk Update Work Skills Schema-
Array of:
object Work Skill
Title:
Work SkillAn array of work skill objects. If the array is empty, then the currently assigned work skills are removed from the resource.
objectWork Skill-
resourceId:
string
Title:
Resource IDMinimum Length:1Maximum Length:32The 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 IDMinimum Value:1The 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:
ItemsAn array of work skill items.
arrayItems-
Array of:
object Work Skill
Title:
Work Skill
objectWork Skill-
endDate:
string
Title:
End DateThe date until when the work skill is effective. Specify the date in 'YYYY-MM-DD' format. -
ratio(required):
integer
Title:
RatioMinimum Value:0Maximum Value:100The skill level of the resource. -
startDate:
string
Title:
Start DateThe date when the work skill takes effect. Specify the date in 'YYYY-MM-DD' format. -
workSkill(required):
string
Title:
Work Skill LabelMaximum Length:40The label of the work skill.
Response
- application/json
200 Response
objectResource Work Skills Bulk Update Schema-
resourcesUpdated:
integer
Title:
Resources UpdatedThe number of resources for which the work skills are updated. -
results:
array Results
Title:
ResultsAn 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.
arrayResults-
Array of:
object Result Item
Title:
Result ItemAn object containing a single result item.
objectResult Item-
errors:
array Errors
Title:
ErrorsThe errors that occurred while updating the work skills. -
itemsFailed:
integer
Title:
Items FailedThe number of failed work skill updates. -
itemsUpdated:
integer
Title:
Items UpdatedThe number of work skills updated for the resource. -
resourceId:
string
Title:
Resource IDThe unique identifier of the resource in Oracle Field Service.
arrayErrorsobject-
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\""
}
}]
}