メタデータAPIを使用したシフト操作の簡略化
メタデータAPIは、シフト構成を管理するための新しい機能セットをサポートするように拡張されました。 この機能改善により、ユーザーはAPIを介してシフトを直接作成、変更および削除できるため、手動での構成が不要になります。 この機能により、企業はシフト・スケジュールの管理を自動化および合理化できるため、プロセスの効率性と拡張性が向上します。
たとえば、大量の勤務スケジュールを管理している顧客は、APIを使用して、初期ロードとしてソース・システムからOracle Fusion Field Serviceにシフトを移行し、手動操作なしで増分更新を処理できます。 同様に、様々なチームやロケーションにまたがる複数のシフトなどの複雑なシフト構成を持つ企業は、APIを使用してシフトを効率的に作成、更新および削除できるため、かなりの時間を節約し、エラーの可能性を低減できます。
シフト構成のAPI操作
メタデータAPIは、シフトの作成、変更および削除機能など、シフト構成を管理するための操作を提供します。 次に、リクエスト・パラメータ、レスポンス形式、使用例など、操作の詳細なリストを示します。
API操作のリスト
1. シフトの作成または更新
メソッド: PUT
パス: /rest/ofscMetadata/v1/shifts/{label}
2. シフトの削除
メソッド: DELETE
パス: /rest/ofscMetadata/v1/shifts/{label}
3. シフトの取得
メソッド: GET
パス: /rest/ofscMetadata/v1/shifts/{label}
4. すべてのシフトの取得
メソッド: GET
パス: /rest/ofscMetadata/v1/shifts
使用例
1. シフトの作成または更新
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. 削除の例
DELETE https://frontend.ofsc.team/rest/ofscMetadata/v1/shifts/blue_default
lHTTP/1.1 204コンテンツなし
シフトは、リソースに割り当てられるとき、繰返しアクティビティにリンクされるとき、勤務スケジュールの一部など、使用中の場合は削除できません。 そのような場合は、409レスポンスが返されます。 削除を許可する前に、すべての関連付けを削除する必要があります。
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10",
"title": "Conflict",
"status": "409",
"detail": "Object is already in use"
}
3. シフトの取得の例
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 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"
}
]
}
無効なパラメータに対するレスポンスの例
1. 無効なjson入力本文
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Invalid JSON"
}
2. 時間パラメータの無効な値
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Invalid parameter type"
}
3. 'regular'シフト・タイプの無効な値
{
"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. 必須'decoration'フィールドの無効な値
{
"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. 'color'フィールドの無効な値
{
"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. 既存のシフトの'type'の値は変更できません
{
"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. 'type'フィールドの無効な値
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'type'. 指定可能な値は['regular', 'on-call']"です。
}
8. 'active'フィールドの無効な値
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'active'. 有効な値は[true, false]です。
}
9. 'workTimeStart'フィールドの無効な値
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
"title": "Bad Request",
"status": "400",
"detail": "Wrong value in field 'workTimeStart'."
}
ビジネス上の利点
- シフトの作成、変更、削除を自動化し、時間を節約し、人的エラーを最小限に抑えます。
- 既存のシステムとのシームレスな統合を可能にし、リアルタイムの更新と運用効率の向上を可能にします。
有効化のステップ
この機能を有効化するうえで必要な操作はありません。
ヒントと考慮事項
N.A