Simplified Shift Operations using Metadata API
The Metadata API has been enhanced to support a new set of functions for managing shift configurations. This enhancement allows users to create, modify, and delete shifts directly through the API, eliminating the need for manual configuration. With this functionality, businesses can automate and streamline the management of shift schedules, making the process more efficient and scalable.
For example, customers managing a large volume of work schedules can use the API to migrate shifts from a source system to Oracle Fusion Field Service as an initial load and then handle incremental updates without manual intervention. Similarly, businesses with complex shift configurations, such as multiple shifts across various teams or locations, can use the API to efficiently create, update, and delete shifts, saving considerable time and reducing the potential for errors.
API Operations for Shift Configuration
The Metadata API provides operations for managing shift configurations, including the ability to create, modify, and delete shifts. Below is a detailed list of the operations, including request parameters, response formats, and usage examples.
List of API Operations
1. Create or update a shift
Method: PUT
Path: /rest/ofscMetadata/v1/shifts/{label}
2. Delete a shift
Method: DELETE
Path: /rest/ofscMetadata/v1/shifts/{label}
3. Get a shift
Method: GET
Path: /rest/ofscMetadata/v1/shifts/{label}
4. Get all shifts
Method: GET
Path: /rest/ofscMetadata/v1/shifts
Examples of Usage
1. Create or update a shift
PUT https://frontend.ofsc.team/rest/ofscMetadata/v1/shifts/yellow_default
Body:
{
"name": "yellow_default",
"active": false,
"type":"regular"
"points": 13,
"workTimeStart": "00:00",
"workTimeEnd": "18:00"
}
RESPONSE 200 OK:
{
"name": "yellow_default",
"active": false,
"type":"regular",
"points": 13,
"workTimeStart": "00:00",
"workTimeEnd": "18:00"
}
2. Example of delete
DELETE https://frontend.ofsc.team/rest/ofscMetadata/v1/shifts/blue_default
lHTTP/1.1 204 No content
A shift cannot be deleted if it is in use, such as when assigned to a resource, linked to a repeating activity, or part of a work schedule. In such cases, the system returns a 409 Conflict response. All associations must be removed before deletion is allowed.
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10",
"title": "Conflict",
"status": "409",
"detail": "Object is already in use"
}
3. Example get shift
GET https://frontend.ofsc.team/rest/ofscMetadata/v1/shifts/blue
{
"label": "blue",
"name": "blue",
"active": false,
"type": "on-call",
"decoration": "blue",
"workTimeStart": "09:00:00",
"workTimeEnd": "18:00:00",
"links": [
{
"rel": "canonical",
"href": "https://frontend.ofsc.team/rest/ofscMetadata/v1/shifts/blue_default"
},
{
"rel": "describedby",
"href": "https://frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
}
4. Get all
GET https://frontend.ofsc.team/rest/ofscMetadata/v1/shifts
{
"hasMore": true,
"totalResults": 294,
"limit": 100,
"offset": 0,
"items": [
{
"label": "forActionsLinkMethods",
"name": "ForAutoTest",
"active": true,
"type": "regular",
"workTimeStart": "09:00:00",
"workTimeEnd": "18:00:00",
"links": [
{
"rel": "canonical",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts/forActionsLinkMethods"
},
{
"rel": "describedby",
"href": "https://frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
},
{
"label": "AutoTestGroupActionDeleteOk",
"name": "AutoTestGroupActionDeleteOk",
"active": true,
"type": "regular",
"workTimeStart": "09:00:00",
"workTimeEnd": "18:00:00",
"links": [
{
"rel": "canonical",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts/AutoTestGroupActionDeleteOk"
},
{
"rel": "describedby",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
},
{
"label": "AutoTestGroupActionDeleteCancel",
"name": "AutoTestGroupActionDeleteCancel",
"active": true,
"type": "regular",
"workTimeStart": "09:00:00",
"workTimeEnd": "18:00:00",
"links": [
{
"rel": "canonical",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts/AutoTestGroupActionDeleteCancel"
},
{
"rel": "describedby",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
},
{
"label": "AutoTestActionActivities",
"name": "AutoTestActionActivities",
"active": true,
"type": "regular",
"workTimeStart": "09:00:00",
"workTimeEnd": "18:00:00",
"links": [
{
"rel": "canonical",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts/AutoTestActionActivities"
},
{
"rel": "describedby",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
},
{
"label": "shift7608000006",
"name": "shift7608000006",
"active": true,
"type": "on-call",
"decoration": "red",
"workTimeStart": "00:00:00",
"workTimeEnd": "23:59:00",
"links": [
{
"rel": "canonical",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts/shift7608000006"
},
{
"rel": "describedby",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
}
],
"links": [
{
"rel": "canonical",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts?limit=100&offset=0"
},
{
"rel": "next",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/shifts?limit=100&offset=100"
},
{
"rel": "describedby",
"href": "https:///frontend.ofsc.team/rest/ofscMetadata/v1/metadata-catalog/shifts"
}
]
}
Example of response for invalid parameters
1. Invalid json input body
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Invalid JSON"
}
2. Invalid value for time parameter
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Invalid parameter type"
}
3. Invalid value for 'regular' shift type
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Field 'decoration' not accepted for 'regular' type of shift."
}
4. Invalid value for mandatory 'decoration' field
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Field 'decoration' is absent. Field 'decoration' mandatory for 'on-call'."
}
5. Invalid value for 'color' field
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'decoration'. Possible values are ['yellow','orange','red','blue','green','purple']."
}
6. Cannot change value for 'type' of existing shift
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Field 'type' cannot be changed for an existing shift."
}
7. Invalid value for 'type' field
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'type'. Possible values are ['regular', 'on-call']."
}
8. Invalid value for 'active' field
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'active'. Possible values are [true, false]."
}
9. Invalid value for 'workTimeStart' field
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'workTimeStart'."
}
Business Benefit
- Automates the creation, modification, and deletion of shifts, saving time and minimizing human error.
- Enables seamless integration with existing systems, allowing real-time updates and improved operational efficiency.
Steps to Enable
You don't need to do anything to enable this feature.
Tips And Considerations
N.A