> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/recipe/hr/freee-hr-custom-work-records.md).

# freee人事労務の勤怠データを取得する

{% hint style="success" %}

### このレシピについて

このレシピは、[freee人事労務 APIリファレンス - 勤怠API](https://developer.freee.co.jp/reference/hr/reference#/%E5%8B%A4%E6%80%A0/get_employee_work_record) を参考に記述されています。
{% endhint %}

## **freee人事労務の「勤怠データ」とは**

freee人事労務で従業員が登録した勤怠に関する情報です。\
（参考：[勤怠を入力・管理する – freee ヘルプセンター](https://support.freee.co.jp/hc/ja/articles/202849560-%E5%8B%A4%E6%80%A0%E3%82%92%E5%85%A5%E5%8A%9B-%E7%AE%A1%E7%90%86%E3%81%99%E3%82%8B)）

freee人事労務API を利用することで、指定した従業員の **勤怠データ**を取得できます。

### **freee人事労務の「勤怠データ」の構造**

```json
{
  "break_records": [],
  "clock_in_at": "2024-04-27T02:48:11.380Z",
  "clock_out_at": "2024-04-27T02:48:11.380Z",
  "date": "2024-04-27T02:48:11.380Z",
  "day_pattern": "normal_day",
  "schedule_pattern": "",
  "early_leaving_mins": 0,
  "half_paid_holiday_mins": 0,
  "half_special_holiday_mins": 0,
  "hourly_paid_holiday_mins": 0,
  "hourly_special_holiday_mins": 0,
  "is_absence": false,
  "is_editable": true,
  "lateness_mins": 0,
  "normal_work_clock_in_at": "2024-04-27T02:48:11.380Z",
  "normal_work_clock_out_at": "2024-04-27T02:48:11.380Z",
  "normal_work_mins": 0,
  "note": "string",
  "paid_holiday": 0,
  "special_holiday": 0,
  "special_holiday_setting_id": 0,
  "use_attendance_deduction": true,
  "use_default_work_pattern": true,
  "use_half_compensatory_holiday": false,
  "total_overtime_work_mins": 0,
  "total_holiday_work_mins": 0,
  "total_latenight_work_mins": 0,
  "not_auto_calc_work_time": false,
  "total_excess_statutory_work_mins": 0,
  "total_latenight_excess_statutory_work_mins": 0,
  "total_overtime_except_normal_work_mins": 0,
  "total_latenight_overtime_except_normal_work_min": 0
}
```

## **Anyflow Embedで取得する**

Anyflow Embedでfreee人事労務の勤怠データを取得する手順を紹介します。

freee人事労務に登録された特定従業員の特定日の勤怠データを**スプレッドシートに一括追加する**というシンプルなソリューションを作成し、従業員の勤怠データを把握します。

<figure><img src="https://files.readme.io/0f237e0-CleanShot_2024-04-27_at_12.17.44.png" alt=""><figcaption></figcaption></figure>

### **1. Clickトリガーを設定する**

Clickトリガーを設定します。

<figure><img src="https://files.readme.io/b9650b7-image.png" alt=""><figcaption></figcaption></figure>

### **2. freee人事労務コネクタを設定する**

freee人事労務コネクタを追加します。

<figure><img src="https://files.readme.io/01fdff0-CleanShot_2024-03-09_at_10.25.27.png" alt=""><figcaption></figcaption></figure>

### **3. 事業所の入力アシストを設定する**

以下の通りエンドユーザー変数を作成します。

<figure><img src="https://files.readme.io/2f152e6-image.png" alt="" width="375"><figcaption></figcaption></figure>

ウィザードの設定に移動します。\
「事業所」のエンドユーザー変数の入力方法を**アシスト**にし、事業所一覧を取得できるようにします。

<figure><img src="https://files.readme.io/16db921-CleanShot_2024-04-27_at_11.53.58.png" alt=""><figcaption></figcaption></figure>

### **4. 「従業員ID」と「日付」のエンドユーザー変数を設定する**

以下のように「従業員ID」のエンドユーザー変数を設定します。型は「String」を選択します。

<figure><img src="https://files.readme.io/2c96c1f-CleanShot_2024-04-27_at_11.56.25.png" alt=""><figcaption></figcaption></figure>

次に、以下のように「日付」のエンドユーザー変数を設定します。型は「Date」を選択します。

<figure><img src="https://files.readme.io/e0574f0-CleanShot_2024-04-27_at_11.57.24.png" alt=""><figcaption></figcaption></figure>

### **5. freee人事労務のカスタムアクションを設定する**

freee人事労務コネクタを以下の通りに設定します。

| 設定項目名       | 設定値      |
| ----------- | -------- |
| カスタムアクション名  | 勤怠データを取得 |
| HTTPメソッド    | GET      |
| リクエストヘッダー   | ※ 設定不要   |
| リクエストタイプ    | ※ 設定不要   |
| レスポンスヘッダー定義 | ※ 設定不要   |
| レスポンスタイプ    | json     |

「リクエストパス」には以下の設定を行います。エンドユーザー変数から「従業員ID」「日付」を選択し、パスの中に含めます。

```
api/v1/employees/{従業員ID}/work_records/{日付}
```

<figure><img src="https://files.readme.io/0b56c35-CleanShot_2024-04-27_at_12.01.44.png" alt=""><figcaption></figcaption></figure>

「リクエストURLパラメータ」には以下の設定を行います。エンドユーザー変数から「事業所」を選択し値に設定します。

<figure><img src="https://files.readme.io/c940b72-CleanShot_2024-04-27_at_12.04.36.png" alt=""><figcaption></figcaption></figure>

また、「レスポンスボディ定義」には以下の設定を行います。

<figure><img src="https://files.readme.io/8a2df18-CleanShot_2024-04-27_at_12.14.15.png" alt="" width="563"><figcaption></figcaption></figure>

### **6. スプレッドシートの列名を設定する**

スプレッドシートコネクタを追加し、以下の通りに設定を行います。

| 設定項目名      | 設定値           |
| ---------- | ------------- |
| アクション      | 1行追加          |
| スプレッドシートID | 任意のスプレッドシートID |
| シートID      | 任意のシートID      |

「ヘッダーの列名」は以下の通りに設定します。

```
clock_in_at
clock_out_at
normal_work_mins
is_absence
```

「行データ」にも同じ様に設定します。

<figure><img src="https://files.readme.io/abf9dfd-CleanShot_2024-04-27_at_12.14.45.png" alt="" width="563"><figcaption></figcaption></figure>

### **7. スプレッドシートに一行追記する**

スプレッドシートコネクタを追加し、以下の通りに設定を行います。

| 設定項目名      | 設定値           |
| ---------- | ------------- |
| アクション      | １行追加          |
| スプレッドシートID | 任意のスプレッドシートID |
| シートID      | 任意のシートID      |

「ヘッダーの列名」は以下の通りに設定します。

```
clock_in_at
clock_out_at
normal_work_mins
is_absence
```

「行データ」は以下の通りに設定します

<figure><img src="https://files.readme.io/6285cd4-CleanShot_2024-04-27_at_12.16.22.png" alt=""><figcaption></figcaption></figure>

### **8. ウィザードを設定する**

必要な認証をウィザードに追加します。

### **9. テストを行う**

テストを行うと、スプレッドシートにデータが追加されていることがわかります。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/recipe/hr/freee-hr-custom-work-records.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
