勤怠管理用のAPIがBioStar2.8.13で追加されました。
勤怠APIについては、以下のリンクを参照してください。
[BioStar 2勤怠API] BioStar 2勤怠APIの使用方法
TA Swaggerで利用可能なその他のAPI関数
- タイムコード関連機能
- シフト関連機能
- スケジュールテンプレート関連機能
- ルール関連機能
- スケジュール関連機能
- 打刻ログ関連機能
TAレポートの取得
[POST] /report.json APIでレポートデータをJSON形式で取得します。
* TAレポートには、日レポート、個人レポート、不在レポートなど、さまざまなレポートタイプがあります。Part3でタイプごとの勤怠レポート取得方法をご確認ください。
Part 1. API呼び出しとパラメーター
[POST]: /report.json
[パラメーター]
名称 | タイプ | *M/O | 説明 | バリュー |
Limit | Int | M | 件数 |
|
Offset | Int | O | 結果データのオフセット |
|
Type | String | M | “CUSTOM”もしくは “callCreateReport” | “CUSTOM” |
Start_datetime | Datetime | M | レポートの開始日時 | YYYY-MM-DD |
End_datetime | Datetime | O | レポートの終了日時 | YYYY-MM-DD |
User_id_list | Array | M | ユーザーのリスト |
|
Group_id_list | Array | O | group_idのリスト |
|
Report_type | String | M | レポートタイプ | “日レポート”など |
Report_filter_type | String | O |
|
|
Language | String | M | レポートの言語 | “en” |
Rebuild_time_card | Boolean | M | Rebuild time or not | “true” |
Columns | Array | M | カラム設定 | 空にすると、すべてのデフォルト列が表示されます。 |
* M – 必須, O – オプション
Part 2. リクエストボディとレスポンスモデル
[リクエストボディ]
{ "limit": 50, "offset": 0, "type": "CUSTOM", "start_datetime": "2021-07-01", "end_datetime": "2021-07-30", "user_id_list": [ "1", "2" ], "group_id_list": [ "1" ], "report_type": "REPORT_DAILY", "report_filter_type": "", "language": "en", "rebuild_time_card": true, "columns": [ {} ] } |
[レスポンス: 成功]
{ "message": "Processed Successfully", "message_key": "SUCCESSFUL", "language": "en", "status_code": "SUCCESSFUL", "records": [ { "datetime": "2021/07/15", "userName": "admin", "userId": "1", "userGroupName": "All Users", "shift": "Case 17", "overtimeRuleShift": false, "leave": "-", "inTime": "08:00:00 ( 08:00:00 )", "outTime": "-", "isInTimeNextDay": false, "isOutTimeNextDay": false, "exception": "Missing Punch Out, Missing Break Start, Missing Break End + 1, Missing Meal Start, Missing Meal End + 1", "exceptionForView": [ { "name": "Missing Punch Out", "code": "6" }, { "name": "Missing Break Start", "code": "9" }, { "name": "Missing Break End", "code": "10" }, { "name": "Missing Break End", "code": "10" }, { "name": "Missing Meal Start", "code": "7" }, { "name": "Missing Meal End", "code": "8" }, { "name": "Missing Meal End", "code": "8" } ], "normalRegular": "2:00:00", "normalOvertime": "0:00:00", "punchBreak": "3:00:00", "overBreak": "0:00:00", "mealTime": "3:00:00", "totalWorkTime": "5:00:00", "regularByTimeRate": "2:00:00", "overtimeByTimeRate": "0:00:00" }, { "datetime": "2021/07/15", "userName": "Sharon", "userId": "2", "userGroupName": "All Users", "shift": "Case 17", "overtimeRuleShift": false, "leave": "-", "inTime": "-", "outTime": "-", "isInTimeNextDay": false, "isOutTimeNextDay": false, "exception": "Absence", "exceptionForView": [ { "name": "Absence", "code": "2" } ], "normalRegular": "0:00:00", "normalOvertime": "0:00:00", "punchBreak": "0:00:00", "overBreak": "0:00:00", "mealTime": "0:00:00", "totalWorkTime": "0:00:00", "regularByTimeRate": "0:00:00", "overtimeByTimeRate": "0:00:00" } ], "total": 2 } |
[レスポンス: エラー]
{ "message": "rebuild_time_card is required.", "message_key": "REQUIRED_FIELD", "language": "en", "status_code": "REQUIRED_FIELD" } |
Part 3. タイプごとレポート取得
*「report_type」パラメーター値を変更して取得するレポートタイプを変更できます。
3-1. 個人レポート
[リクエストボディ]
{ "limit": 50, "offset": 0, "type": "callCreateReport", "start_datetime": "2020-12-07", "end_datetime": "2020-12-07", "report_type": "REPORT_INDIVIDUAL", "report_filter_type": "INDIVIDUAL_FILTER_SUMMARY", "user_id_list": [ "1", "2", "3" ], "language": "en", "rebuild_time_card": true, "columns": [ { "name": "report.userName", "field": "userName", "displayName": "Name", "leaveType": false }, { "name": "report.userId", "field": "userId", "displayName": "UserID", "leaveType": false }, { "name": "report.department", "field": "userGroupName", "displayName": "Department", "leaveType": false }, { "name": "timeCard.regularHours", "field": "normalRegular", "displayName": "Regularhours", "leaveType": false }, { "name": "timeCard.overtimeHours", "field": "normalOvertime", "displayName": "Overtimehours", "leaveType": false }, { "name": "report.totalWorkTime", "field": "totalWorkTime", "displayName": "TotalWorkHours", "leaveType": false }, { "name": "reportHeader.absence", "field": "absence", "displayName": "NoofAbsence", "leaveType": false }, { "name": "reportHeader.insufficientWorkTime", "field": "insufficientWorkTime", "displayName": "NoofInsufficientWorkTime", "leaveType": false }, { "name": "reportHeader.lateIn", "field": "lateIn", "displayName": "NoofLateIn", "leaveType": false }, { "name": "reportHeader.earlyOut", "field": "earlyOut", "displayName": "NoofEarlyOut", "leaveType": false }, { "name": "reportHeader.missingEventType", "field": "missingEventType", "displayName": "NoofMissingEventType", "leaveType": false }, { "name": "reportHeader.missingPunchIn", "field": "missingPunchIn", "displayName": "NoofMissingPunchIn", "leaveType": false }, { "name": "reportHeader.missingPunchOut", "field": "missingPunchOut", "displayName": "NoofMissingPunchOut", "leaveType": false } ], "sort_columns": [], "userCustomFields": {} } |
[レスポンス: 成功]
{ "message": "Processed Successfully", "message_key": "SUCCESSFUL", "language": "en", "status_code": "SUCCESSFUL", "records": [ { "hidden_user_id": "1", "userName": "admin (1 : All Users ) ", "$$treeLevel": 0, "normalRegular": "0:00:00", "normalOvertime": "0:00:00", "totalWorkTime": "0:00:00", "punchBreak": "0:00:00", "overBreak": "0:00:00", "mealTime": "0:00:00", "regularByTimeRate": "0:00:00", "overtimeByTimeRate": "0:00:00" }, { "hidden_user_id": "2", "userName": "Sharon (2 : All Users ) ", "$$treeLevel": 0, "normalRegular": "0:00:00", "normalOvertime": "0:00:00", "totalWorkTime": "0:00:00", "punchBreak": "0:00:00", "overBreak": "0:00:00", "mealTime": "0:00:00", "regularByTimeRate": "0:00:00", "overtimeByTimeRate": "0:00:00" } ], "total": 2 } |
3-2. 不在レポート
[リクエストボディ]
{ "limit": 50, "offset": 0, "type": "callCreateReport", "start_datetime": "2020-12-07", "end_datetime": "2020-12-07", "report_type": "REPORT_LEAVE", "user_id_list": [ "1" ], "sort_columns": [], "filter": [], "columns": [ { "name": "report.date", "field": "datetime", "displayName": "Date" }, { "name": "report.userName", "field": "userName", "displayName": "Name" }, { "name": "report.userId", "field": "userId", "displayName": "User ID" }, { "name": "report.department", "field": "userGroupName", "displayName": "Department" }, { "name": "report.shift", "field": "shift", "displayName": "Shift" }, { "name": "report.leave", "field": "leave", "displayName": "Leave" }, { "name": "reportHeader.leavePeriod", "field": "leavePeriod", "displayName": "Leave Period" } ], "rebuild_time_card": true, "query": { "language": "en" } } |
3-3. 例外レポート
[リクエストボディ]
{ "limit": 50, "offset": 0, "type": "callCreateReport", "report_type": "REPORT_EXCEPTION", "start_datetime": "2020-12-07", "end_datetime": "2020-12-07", "user_id_list": [ "1", "2", "3" ], "sort_columns": [], "filter": [], "columns": [ { "name": "report.date", "field": "datetime" }, { "name": "report.userName", "field": "userName" }, { "name": "report.userId", "field": "userId" }, { "name": "report.department", "field": "userGroupName" }, { "name": "report.shift", "field": "shift" }, { "name": "report.leave", "field": "leave" }, { "name": "timeCard.in", "field": "inTime" }, { "name": "timeCard.out", "field": "outTime" }, { "name": "report.exception", "field": "exception" }, { "name": "timeCard.regularHours", "field": "normalRegular" }, { "name": "timeCard.overtimeHours", "field": "normalOvertime" }, { "name": "report.totalWorkTime", "field": "totalWorkTime" } ], "rebuild_time_card": true, "query": { "language": "en" } } |
3-4. 履歴編集レポート
[リクエストボディ]
{ "limit": 50, "offset": 0, "type": "callCreateReport", "report_type": "REPORT_EDIT_HISTORY", "start_datetime": "2020-12-07", "end_datetime": "2020-12-07", "user_id_list": [ "1", "2", "3" ], "sort_columns": [], "filter": [], "columns": [ { "name": "report.date", "field": "datetime" }, { "name": "report.userName", "field": "userName" }, { "name": "report.userId", "field": "userId" }, { "name": "report.department", "field": "userGroupName" }, { "name": "report.shift", "field": "shift" }, { "name": "report.leave", "field": "leave" }, { "name": "timeCard.in", "field": "inTime" }, { "name": "timeCard.out", "field": "outTime" }, { "name": "report.exception", "field": "exception" }, { "name": "timeCard.regularHours", "field": "normalRegular" }, { "name": "timeCard.overtimeHours", "field": "normalOvertime" }, { "name": "report.totalWorkTime", "field": "totalWorkTime" } ], "rebuild_time_card": true, "query": { "language": "en" } } |
Part 4. Postmanにてレポート取得
[リクエスト例: ヘッダー]
*[POST] /report.json APIにてログインしてください。
*アクセスコントロールNew Local APIのbe-session-idとは異なり、bs-ta-session-idはCookieで送信する必要があります。勤怠APIのログインAPIを介してログインすると、Bs-ta-session-idがCookieに自動的に送信されます。
[リクエスト例]
[レスポンス例: ボディ]