従業員所属グループ登録・更新
PUT
/staffs/{staff_id}/staff_groups/{staff_group_code}
const url = 'https://api.smaregi.dev/TARGET-CONTRACT-ID/timecard/staffs/1/staff_groups/10';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"positionIdList":["1","3"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.smaregi.dev/TARGET-CONTRACT-ID/timecard/staffs/1/staff_groups/10 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "positionIdList": [ "1", "3" ] }'指定した従業員の従業員所属グループを登録・更新します(upsert)。
指定した staff_id × staff_group_code の所属が未存在の場合は登録し(201)、
既存の場合は更新します(200)。
対象
- プラン
- スタンダード
- プレミアム
- プレミアムプラス
- エンタープライズ
対象ユーザー権限
- 従業員管理編集(全て)
- 従業員管理編集(給与情報除く)
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”staff_id
required
string
従業員ID
Example
1staff_group_code
required
string
従業員グループコード
Example
10Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
positionIdList
required
役職IDリスト(空配列を許容)
Array<string>
Examples
役職を全置換する例
{ "positionIdList": [ "1", "3" ]}役職を全件クリアする例
{ "positionIdList": []}Responses
Section titled “Responses”更新成功
Media typeapplication/json
object
staffId
従業員ID
string
staffGroupCode
従業員グループコード
string
positionIdList
役職IDリスト
Array<string>
Example
{ "staffId": "1", "staffGroupCode": "10", "positionIdList": [ "1", "3" ]}作成成功
Media typeapplication/json
object
staffId
従業員ID
string
staffGroupCode
従業員グループコード
string
positionIdList
役職IDリスト
Array<string>
Example
{ "staffId": "1", "staffGroupCode": "10", "positionIdList": [ "1", "3" ]}- リクエスト形式が不正な場合
- 参照整合性・業務制約に違反する場合
Media typeapplication/json
object
type
エラータイプを識別するURI、もしくはabout:blank
string
title
エラーの概要
string
detail
エラーの詳細
string
Example
{ "type": "about:blank", "title": "Bad Request", "detail": "positionIdList に無効な役職IDが含まれています。"}- 指定した従業員IDのデータが存在しない場合
- 指定した従業員グループコードが存在しない場合
Media typeapplication/json
object
type
エラータイプを識別するURI、もしくはabout:blank
string
title
エラーの概要
string
detail
エラーの詳細
string
Example
{ "type": "about:blank", "title": "Not Found", "detail": "データが確認できませんでした。従業員グループコード: 999"}