Download OpenAPI specification:
Airtunk hotel valley service API
AuthorizationヘッダーでBearerトークンを送信する
(axios.tsのインターセプターでヘッダーに付与する形になっているので、開発者が意識することではない)
全てのapi呼び出しで、アクセストークン検証を実施しますが、有効な場合、コンテキストに自分情報を追加します
jwtトークンを検証するミドルウェア
(airtrunk-ibd/src/app/Http/Middleware/VerifyJwtToken.php)にて、
Bearerトークンを分解。
分解後、token.subを使用して、staff.subから、ホテルや配送スタッフの情報を検索し、コンテキストに追加する
※ コンテキストに追加するのは、各apiで、リクエストされたユーザーの情報を使いまわすためである)
※ また、ログ出力も考慮すると、自分情報をコンテキストに追加しておく対応が必要。
Cognito認証を実行します。MFAが必要な場合はsessionを返却し、 MFAが不要な場合はアクセストークンを直接返却します。
| email required | string <email> メールアドレス |
| password required | string >= 8 characters パスワード |
{- "email": "user@example.com",
- "password": "SecurePassword123!"
}{- "status": "SUCCESS",
- "accessToken": "eyJhbGciOiJSUzI1NiIs...",
- "idToken": "eyJhbGciOiJSUzI1NiIs...",
- "refreshToken": "eyJjdHkiOiJKV1QiLCJlb...",
- "user": {
- "id": "12345",
- "email": "user@example.com",
- "name": "田中太郎"
}
}Email で送信された認証コードを検証し、 成功時はJWTトークン一式を返却します。
| session required | string ログインAPIから取得したセッション |
| challengeResponse required | string^[0-9]{6}$ Email で受信した認証コード |
{- "session": "AYABeA...",
- "challengeResponse": "123456"
}{- "accessToken": "eyJhbGciOiJSUzI1NiIs...",
- "idToken": "eyJhbGciOiJSUzI1NiIs...",
- "refreshToken": "eyJjdHkiOiJKV1QiLCJlb...",
- "user": {
- "id": "12345",
- "email": "user@example.com",
- "name": "田中太郎",
- "mfaEnabled": true
}
}Cognito Global Sign Outを実行し、JWTトークンを無効化します。 アクセストークンをリクエストボディに含めてください。
| accessToken required | string アクセストークン(JWT) |
{- "accessToken": "eyJhbGciOiJSUzI1NiIs..."
}{- "message": "ログアウトしました"
}リフレッシュトークンを使用して新しいアクセストークンとIDトークンを取得します。
| refreshToken required | string リフレッシュトークン(JWT) |
{- "refreshToken": "eyJjdHkiOiJKV1QiLCJlb..."
}{- "accessToken": "eyJhbGciOiJSUzI1NiIs...",
- "idToken": "eyJhbGciOiJSUzI1NiIs..."
}JWTトークンから認証済みユーザーの情報を取得します。
ユーザー情報取得処理では、フロントエンドでの表示制御のため、自分情報を返却する
at-admin, at-sc-admin, at-sc
at-admin, at-sc-adminは、管理画面等では全てのホテル、全ての空港が検索できることになるat-airport
hotel-admin, hotel
{- "user": {
- "uuid": "550e8400-e29b-41d4-a716-446655440001",
- "first_name": "太郎",
- "last_name": "田中",
- "email": "admin@airtrunk.example.com",
- "role": "at-admin",
- "hotel_ids": null,
- "airport_reception_id": null
}
}email,name,'hotel_id'と合致するデータを探す| email required | string <email> |
| name required | string 利用者氏名 |
| hotel_id required | string <uuid> 宿泊予定ホテルのid |
{- "email": "aaa@gmail.com",
- "name": "やまだ ひさし",
- "hotel_id": 1
}{- "result": true
}指定されたクエリ条件に基づき、申込テーブルから申込データを取得します。 リレーションを利用して、以下の関連情報も併せて取得します。
| page | integer >= 1 Default: 1 ページ番号 |
| per_page | integer [ 1 .. 100 ] Default: 20 1ページあたりの件数 |
| reservation_holder_name | string 宿泊予約者名 |
| user_name | string 利用者名 |
string メールアドレス | |
| phone_number | string 電話番号 |
| delivery_status | string 配送ステータス |
| hotel_name | string ホテル名 |
| check_in_date | string <date> チェックイン日 |
| luggage_qr_code | string 荷物qrコードの番号 |
{- "data": [
- {
- "application_id": "string",
- "reservation_holder_name": "string",
- "user_name": "string",
- "email": "user@example.com",
- "phone_number": "string",
- "delivery_status": "applied",
- "hotel_name": "string",
- "check_in_date": "2019-08-24",
- "traveler_qr_code": "string",
- "luggage_qr_code": "string",
- "luggage_reception_time": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "current_page": 1,
- "total_pages": 0,
- "total_count": 0,
- "per_page": 1
}
}受け取った情報を下記のテーブルに保存
| reservation_holder_name required | string 宿泊旅行者名 |
| user_name required | string 利用者名 |
| relationship_with_guest required | string 宿泊者とのご関係 |
| email required | string メールアドレス |
| phone_number required | string 電話番号 |
| hotel_id required | string ホテルid |
| hotel_name required | string ホテル名 |
| hotel_address required | string ホテル住所 |
| check_in_date required | string <date> チェックイン日 |
| check_out_date required | string <date> チェックアウト日 |
| airport_id required | string 空港id |
| estimated_arrival_datetime required | string <date-time> 到着予定日時 |
| flight_number | string or null 便名(任意) |
| counter_arrival_datetime required | string <date-time> 預入カウンターの到着予定日時 |
| luggage_quantity required | integer 荷物の個数 |
| coupon_code | string or null クーポンコード |
{- "reservation_holder_name": "string",
- "user_name": "string",
- "relationship_with_guest": "string",
- "email": "string",
- "phone_number": "string",
- "hotel_id": "string",
- "hotel_name": "string",
- "hotel_address": "string",
- "check_in_date": "2019-08-24",
- "check_out_date": "2019-08-24",
- "airport_id": "string",
- "estimated_arrival_datetime": "2019-08-24T14:15:22Z",
- "flight_number": "string",
- "counter_arrival_datetime": "2019-08-24T14:15:22Z",
- "luggage_quantity": 0,
- "coupon_code": "string"
}{- "application_id": "string"
}| application_id required | string Example: 550e8400-e29b-41d4-a716-446655440001 申し込みID |
{- "customer_info": {
- "application_id": "550e8400-e29b-41d4-a716-446655440001",
- "reservation_holder_name": "山田 太郎",
- "user_name": "山田 太郎",
- "relationship_with_guest": "本人",
- "email": "yamada@example.com",
- "phone_number": "090-1234-5678",
- "country_name": "日本"
}, - "hotel_info": {
- "hotel_id": "550e8400-e29b-41d4-a716-446655440000",
- "hotel_name": "東急ホテル銀座",
- "hotel_address": "東京都中央区銀座1-2-3",
- "check_in_date": "2024-12-01",
- "check_out_date": "2024-12-05"
}, - "airport_info": {
- "airport_id": "550e8400-e29b-41d4-a716-446655440002",
- "estimated_arrival_datetime": "2024-12-01T14:30:00+09:00",
- "flight_number": "JL001"
}, - "counter_info": {
- "counter_arrival_datetime": "2024-12-01T15:00:00+09:00"
}, - "luggage_info": {
- "quantity": 2,
- "luggage_qr_codes": [
- "LUG-2024-001-001",
- "LUG-2024-001-002"
]
},
}荷物 QR コードを申込情報に紐づけ、預かり同意サインを保存し、預かり同意状態へ更新する処理を行います。
預かり同意サイン(signature)を S3 にアップロード
申込テーブルの更新
荷物管理テーブルへの登録
luggage_qr_codes に含まれる各 QR コードと
applicationId を紐づけて荷物管理テーブルへ保存します。| application_id required | string 申し込みID |
| signature required | string <binary> 顧客のサイン(画像ファイル) |
| luggage_qr_codes | Array of strings |
{- "message": "申し込みデータがありません"
}荷物 QR コードを申込情報に紐づけ、受け渡しサインを保存し、受け渡し完了状態へ更新する処理を行います。
受け渡しサイン(signature)を S3 にアップロード
申込テーブルの更新
荷物管理テーブルへの登録
luggage_qr_codes に含まれる各 QR コードと
applicationId を紐づけて荷物管理テーブルへ保存します。| application_id required | string 申し込みID |
| signature required | string <binary> 顧客のサイン(画像ファイル) |
{- "message": "申し込みデータがありません"
}預かり同意保存後に、後から追加した荷物を旅行者と紐づける
| application_id required | string 申し込みID |
| luggage_qr_code required | string 荷物qr番号 |
{- "luggage_qr_code": "string"
}{- "message": "申し込みデータがありません"
}荷物と旅行者の紐づけを外す
指定された application_id と luggage_qr_code に基づき、以下の処理を行う。
application_id と luggage_qr_code が一致する荷物管理データを荷物管理テーブルから検索する。| application_id required | string 申し込みID |
| luggage_qr_code required | string 荷物QRコード |
| luggage_qr_code required | string 荷物qr番号 |
{- "luggage_qr_code": "string"
}{- "message": "申し込みデータがありません"
}指定された applicationId を基に、以下の手順で荷物のロケーションデータを取得する。
荷物管理テーブルからの検索
applicationId をキーとして、荷物管理テーブルから該当する荷物管理データを取得する。配送実績データの取得
id を基に、配送実績テーブルから関連する配送実績データを取得し、荷物のロケーション情報として返却する。| application_id required | string 申し込みID |
{- "location_info": {
- "departure_location_name": "string",
- "departure_datetime": "2019-08-24T14:15:22Z",
- "arrival_location_name": "string",
- "arrival_datetime": "2019-08-24T14:15:22Z"
}
}空港受付一覧取得
| page | integer >= 1 Default: 1 ページ番号 |
| per_page | integer [ 1 .. 100 ] Default: 20 1ページあたりの件数 |
{- "data": [
- {
- "airport_id": "string",
- "airport_name": "string"
}
], - "pagination": {
- "current_page": 1,
- "total_pages": 0,
- "total_count": 0,
- "per_page": 1
}
}空港締め管理テーブルにデータを作成します。
| counter_id required | string 空港受付Id |
| staff_id required | string スタッフ |
{- "staff_id": "string"
}{- "message": "空港データがありません"
}スキャンした車両QRコードをもとに、ログインしているスタッフの担当車両を取得する。
| staff_id required | string スタッフID |
| vehicle_id required | string 車両ID |
[- {
- "vehicle": {
- "id": "string",
- "logical_id": "string",
- "types": "string",
- "number": "string",
- "management": "string",
- "memo": "string"
}, - "route": {
- "location_id": "string",
- "location_name": "string",
- "location_memo": "string"
}
}
]{- "pickup_info": {
- "pickup_delivery_type": "string",
- "location_id": "string",
- "luggage_route_detail_id": "string",
- "address": "string",
- "pickup_quantity": 0
}, - "delivery_info": {
- "location_id": "string",
- "luggage_route_detail_id": "string",
- "address": "string",
- "delivery_quantity": 0,
- "work_instruction": "string"
}
}上記で取得したidとlocation_idが同じか検証する
| destination_id required | string 行き先ID |
| location_id required | string スキャンしたロケーションのid |
{- "location_id": "string"
}{- "result": true,
- "location_id": "string"
}指定された行き先 ID に関連する荷物データを取得する。
行き先 ID と一致するホテルデータを、ホテルテーブルから検索する。
取得したホテルデータの ID に紐づく申込データを、申込テーブルから取得する。
見つかった申込データと紐づく荷物データを検索し、結果として返却する。
行き先 ID と一致する空港データを、空港テーブルから検索する。
取得した空港データの ID に紐づく申込データを、申込テーブルから取得する。
見つかった申込データと紐づく荷物データを検索し、結果として返却する。
| destination_id required | string 行き先ID |
{- "application_info": {
- "application_id": "string",
- "reservation_holder_name": "string",
- "user_name": "string",
- "luggage_qr_code": "string"
}
}荷物と配達先が一致してるか調べる
| destination_id required | string 行き先ID |
| location_id required | string スキャンしたロケーションのid |
| luggage_qr_code required | string 荷物qr番号 |
{- "location_id": "string",
- "luggage_qr_code": "string"
}{- "result": true,
- "location_id": "string"
}photos に含まれる全ての画像が処理されるまで、以下の手順を繰り返す。
photo を S3 にアップロードする。application_ids に含まれる各 id と紐づけて保存する。staff_id,hotel_id,location_typeを配送実績に保存する| destination_id required | string 行き先ID |
| staff_id required | string スタッフid |
| location_type required | string ロケーションタイプ |
| hotel_id required | string ホテルid |
| application_ids required | Array of strings |
| luggage_qr_codes required | Array of strings |
| photos required | Array of any |
{- "message": "行き先データがありません"
}staff_id,hotel_id,location_typeを配送実績に保存する| destination_id required | string 行き先ID |
| staff_id required | string スタッフid |
| location_type required | string ロケーションタイプ |
| hotel_id required | string ホテルid |
| application_ids required | Array of strings |
| luggage_qr_codes required | Array of strings |
| signature required | string <binary> サイン(画像ファイル) |
{- "message": "行き先データがありません"
}staff_id,location_type,location_idに関してはairtport_idとして配送実績テーブルに保存する| destination_id required | string 行き先ID |
| luggage_qr_codes required | Array of strings |
| staff_id required | string スタッフid |
| location_type required | string ロケーションタイプ |
| location_id | string スキャンしたロケーションのid |
{- "luggage_qr_codes": [
- "string"
], - "staff_id": "string",
- "location_type": "空港",
- "location_id": "string"
}{- "message": "行き先データがありません"
}配送ステータス強制変更API
| destination_id required | string 行き先ID |
| delivery_status required | string 配送ステータス |
| application_ids required | Array of strings |
{- "delivery_status": "string",
- "application_ids": [
- "string"
]
}{- "message": "行き先データがありません"
}ホテルID と一致するホテルデータを、ホテルテーブルから検索する。
取得したホテルデータの ID に紐づく申込データを、申込テーブルから取得する。
見つかった申込データと紐づく荷物データを検索し、結果として返却する。
| hotel_id required | string ホテルID |
{- "application_info": {
- "application_id": "string",
- "reservation_holder_name": "string",
- "user_name": "string"
}, - "luggage_info": {
- "luggage_qr_code": "string"
}
}検品完了状態にする
| hotel_id required | string ホテルID |
| luggage_qr_codes required | Array of strings |
{- "luggage_qr_codes": [
- "string"
]
}{- "message": "ホテルデータがありません"
}| group_id required | string グループID |
{- "group": {
- "group_id": 11111,
- "group_name": "東急",
- "areas": [
- {
- "area_id": 1234,
- "area_name": "渋谷",
- "hotels": [
- {
- "id": "220e8400-e29b-41d4-a716-44665541234",
- "logical_id": "220e8400-e29b-41d4-a716-44665541234",
- "hotel_area_id": "220e8400-e29b-41d4-a716-44665541234",
- "hotel_group_id": "220e8400-e29b-41d4-a716-44665541234",
- "japanese_name": "東急ホテル渋谷",
- "english_name": "Tokyu Plaza Sibuya",
- "address": "東京都 渋谷区",
- "latitude": 2222.22222,
- "longitude": 2222.22222,
- "memo": "搬入口はホテルの裏",
- "delivery_priority": 2,
- "operation_status": "contact_less",
- "applicable_start_date": "2022-11-23",
- "applicable_end_date": null,
- "created_at": "2022-11-23",
- "updated_at": "2022-11-23",
- "deleted_at": null
}
]
}
]
}
}※ クーポンと言っているが、割引などではなく認証のためのコードなので注意
取得したクーポンコードデータについて、以下の条件で「今日の日時」が有効期間内かどうかを検証する。
適用開始日時 ≤ 今日の日時 < 適用終了日時
上記条件を満たす場合、認証は有効と判定する。
| hotel_id required | string ホテルid |
| coupon_code required | string クーポンコード |
{- "hotel_id": "string",
- "coupon_code": "string"
}{- "result": true
}