Bulk update resource work skills

post

/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

Body ()
Root Schema : Bulk Update Work Skills Schema
Type: array
Title: Bulk Update Work Skills Schema
Show Source
  • 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.
Nested Schema : Work Skill
Type: object
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.
Show Source
  • 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
  • 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
  • Items
    Title: Items
    An array of work skill items.
Nested Schema : Items
Type: array
Title: Items
An array of work skill items.
Show Source
Nested Schema : Work Skill
Type: object
Title: Work Skill
Show Source
  • Title: End Date
    The date until when the work skill is effective. Specify the date in 'YYYY-MM-DD' format.
  • Title: Ratio
    Minimum Value: 0
    Maximum Value: 100
    The skill level of the resource.
  • Title: Start Date
    The date when the work skill takes effect. Specify the date in 'YYYY-MM-DD' format.
  • Title: Work Skill Label
    Maximum Length: 40
    The label of the work skill.
Back to Top

Response

Supported Media Types

200 Response

This section describes the 200 status response for this operation.
Body ()
Root Schema : Resource Work Skills Bulk Update Schema
Type: object
Title: Resource Work Skills Bulk Update Schema
Show Source
  • Title: Resources Updated
    The number of resources for which the work skills are updated.
  • 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.
Nested Schema : Results
Type: array
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.
Show Source
Nested Schema : Result Item
Type: object
Title: Result Item
An object containing a single result item.
Show Source
Nested Schema : Errors
Type: array
Title: Errors
The errors that occurred while updating the work skills.
Show Source
Nested Schema : Error
Type: object
Show Source

Default Response

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

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\""
            }
        }]
}
Back to Top