MENU

料金プラン

機能一覧

デモ

ご利用の流れ

お役立ちコラム



予約(Appointents)

操作ガイド

Amelia API – 予約

ここでは、予約に関連するAPIエンドポイントを確認できます。

リクエストとレスポンスの例を含むすべてのAPIエンドポイントは、こちらからダウンロードできるAmelia API Postmanコレクションで確認できます。

APIエンドポイントの使用には一定レベルのコーディングスキルが必要であり、プラグイン付属のサポートには含まれていません。

認証

すべてのAmeliaエンドポイントは、「Amelia」という名前のヘッダープロパティを使用したAPIキー認証を使用します。

パス

Amelia APIのパスは、以下の形式で始まります。

{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1

予約の追加

予約情報を含めて予約を作成します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/appointments

必須プロパティ

以下のプロパティが必須です。

キータイプ説明
bookingStartstring予約の開始日時。「YYYY-MM-DD HH:mm」形式。
bookingsarray予約情報の配列。予約オブジェクトには、既存のお客様customerIdが含まれている必要があります。予約時に新しいお客様を作成したい場合は、/bookingsエンドポイントを使用してください。
notifyParticipantsbooleanお客様に予約について通知するかどうか。
locationIdinteger予約の場所ID。
providerIdinteger予約に割り当てられたスタッフのID。
serviceIdinteger予約のサービスID。
recurringarray定期的な予約の配列。予約が定期的なものである場合は必須です。

その他のプロパティ

キータイプ説明
internalNotesstring内部メモ。
timeZonestringお客様のタイムゾーン。例:「Europe/Belgrade」
lessonSpacestring予約に割り当てるレッスン空間ID。デフォルトでは新規作成されます。
utcboolean日付時刻がUTC(協定世界時)で送信されるかどうか。デフォルトはFalseです。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
    "bookingStart": "2023-10-05 13:00",
    "bookings": [
        {
            "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
            "customerId": 10,
            "duration": 1800,
            "extras": [],
            "packageCustomerId": null,
            "persons": 1,
            "status": "approved"
        }
    ],
    "internalNotes": "",
    "lessonSpace": "",
    "locationId": 2,
    "notifyParticipants": 1,
    "providerId": 1,
    "recurring": [],
    "serviceId": 1,
    "timeZone": "Europe/Belgrade",
    "utc": false
}'
レスポンス
{
    "message": "Successfully added new appointment",
    "data": {
        "appointment": {
            "id": 742,
            "bookings": [
                {
                    "id": 979,
                    "customerId": 10,
                    "customer": null,
                    "status": "approved",
                    "extras": [],
                    "couponId": null,
                    "price": 23,
                    "coupon": null,
                    "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                    "info": null,
                    "appointmentId": 742,
                    "persons": 1,
                    "token": "e22f812066",
                    "payments": [
                        {
                            "id": 1000,
                            "customerBookingId": 979,
                            "packageCustomerId": null,
                            "parentId": null,
                            "amount": 0,
                            "gateway": "onSite",
                            "gatewayTitle": "",
                            "dateTime": "2023-10-05 13:00:00",
                            "status": "pending",
                            "data": "",
                            "entity": "appointment",
                            "created": null,
                            "actionsCompleted": true,
                            "wcOrderId": null,
                            "wcOrderUrl": null,
                            "wcItemCouponValue": null,
                            "wcItemTaxValue": null,
                            "transactionId": null
                        }
                    ],
                    "utcOffset": null,
                    "aggregatedPrice": true,
                    "isChangedStatus": true,
                    "isLastBooking": null,
                    "packageCustomerService": null,
                    "ticketsData": [],
                    "duration": 1800,
                    "created": "2023-09-26 10:19:00",
                    "actionsCompleted": true,
                    "isUpdated": null
                }
            ],
            "notifyParticipants": 1,
            "internalNotes": "",
            "status": "approved",
            "serviceId": 1,
            "parentId": null,
            "providerId": 1,
            "locationId": 2,
            "provider": null,
            "service": null,
            "location": null,
            "googleCalendarEventId": null,
            "googleMeetUrl": null,
            "outlookCalendarEventId": null,
            "zoomMeeting": null,
            "lessonSpace": null,
            "bookingStart": "2023-10-05 13:00:00",
            "bookingEnd": "2023-10-05 13:30:00",
            "type": "appointment",
            "isRescheduled": null,
            "isFull": null,
            "resources": []
        },
        "recurring": []
    }
}

予約の更新

予約の詳細を更新します。予約ステータスを更新するには、/appointments/statusエンドポイントを使用してください。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/appointments/{{appointment_id}}

オプションプロパティ

更新したいプロパティのみを送信してください。

キータイプ説明
bookingStartstring予約の開始日時。「YYYY-MM-DD HH:mm」形式。
bookingsarray予約情報の配列。
notifyParticipantsbooleanお客様に予約について通知するかどうか。
locationIdinteger予約の場所ID。
providerIdinteger予約に割り当てられたスタッフのID。
serviceIdinteger予約のサービスID。
internalNotesstring内部メモ。
lessonSpacestring予約に割り当てるレッスン空間ID。デフォルトでは新規作成されます。
removedBookingsarray削除される予約の配列。
recurringarray定期的な予約の配列。予約が定期的なものである場合は必須です。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments/742' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
    "bookingStart": "2023-10-05 11:00",
    "bookings": [
        {
            "id": 979,
            "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
            "customerId": 10,
            "duration": 1800,
            "extras": [],
            "packageCustomerId": null,
            "persons": 2,
            "status": "approved"
        }
    ],
    "internalNotes": "",
    "lessonSpace": "",
    "locationId": 2,
    "notifyParticipants": 1,
    "providerId": 1,
    "removedBookings": [],
    "serviceId": 1
}
レスポンス
{
    "message": "Successfully updated appointment",
    "data": {
        "appointment": {
            "id": 742,
            "bookings": [
                {
                    "id": 979,
                    "customerId": 10,
                    "customer": null,
                    "status": "approved",
                    "extras": [],
                    "couponId": null,
                    "price": 23,
                    "coupon": null,
                    "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                    "info": null,
                    "appointmentId": null,
                    "persons": 2,
                    "token": null,
                    "payments": [],
                    "utcOffset": null,
                    "aggregatedPrice": null,
                    "isChangedStatus": false,
                    "isLastBooking": null,
                    "packageCustomerService": null,
                    "ticketsData": [],
                    "duration": 1800,
                    "created": "2023-09-26 10:19:00",
                    "actionsCompleted": null,
                    "isUpdated": true
                }
            ],
            "notifyParticipants": 1,
            "internalNotes": "",
            "status": "approved",
            "serviceId": 1,
            "parentId": null,
            "providerId": 1,
            "locationId": 2,
            "provider": null,
            "service": null,
            "location": null,
            "googleCalendarEventId": "hlda2snvbh7llqbupsgnels3io",
            "googleMeetUrl": null,
            "outlookCalendarEventId": "AQMkADAwATYwMAItZTk0ZS1lMGRmLTAwAi0wMAoARgAAA3egvCudOo1GsyywV8xCQ2wHANjP2dT7pGFAu0b6VBSGJOoAAAIBDQAAANjP2dT7pGFAu0b6VBSGJOoABsaEPm0AAAA=",
            "zoomMeeting": {
                "id": 76092515836,
                "startUrl": "https://us04web.zoom.us/s/76092515836?zak=eyJ0eXAiOiJKV1QiLCJzdiI6IjAwMDAwMSIsInptX3NrbSI6InptX28ybSIsImFsZyI6IkhTMjU2In0.eyJhdWQiOiJjbGllbnRzbSIsInVpZCI6IlBNUVVXdlVXVEJLMVh6cW11YVM2LUEiLCJpc3MiOiJ3ZWIiLCJzayI6Ijg0OTc4OTYwMzQ5OTI5NjU2NDUiLCJzdHkiOjEwMCwid2NkIjoidXMwNCIsImNsdCI6MCwibW51bSI6Ijc2MDkyNTE1ODM2IiwiZXhwIjoxNjk1NzIzNTQyLCJpYXQiOjE2OTU3MTYzNDIsImFpZCI6Ing4ejhiTG1WUzJLODA0aktOa09lTmciLCJjaWQiOiIifQ.5stnr-oa5EhUGp5H_oIrb9ckfTq6WGu0TxGw7Mzo7t4",
                "joinUrl": "https://us04web.zoom.us/j/76092515836?pwd=O3kmYBTPHsxTSMKe7mKrAbSllftaJ7.1"
            },
            "lessonSpace": null,
            "bookingStart": "2023-10-05 11:00:00",
            "bookingEnd": "2023-10-05 11:30:00",
            "type": "appointment",
            "isRescheduled": null,
            "isFull": null,
            "resources": []
        },
        "appointmentStatusChanged": false,
        "appointmentRescheduled": false,
        "initialAppointmentDateTime": {
            "bookingStart": "2023-10-05 11:00:00",
            "bookingEnd": "2023-10-05 11:30:00"
        },
        "bookingsWithChangedStatus": [],
        "appointmentEmployeeChanged": null,
        "appointmentZoomUserChanged": false,
        "bookingAdded": false,
        "appointmentZoomUsersLicenced": false,
        "createPaymentLinks": null
    }
}

予約ステータスの更新

予約グループのステータスを更新します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

appointments/status/{{appointment_id}}

必須プロパティ

以下のプロパティが必須です。

キータイプ説明
statusstring新しい予約ステータス。取りうる値: approved (承認済み)、pending (保留中)、canceled (キャンセル済み)、rejected (拒否済み)、no-show (無断欠席)
packageCustomerIdinteger予約がコースの一部である場合、お客様コースID。

レスポンス
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments/status/742'
--header 'Content-Type: application/json'
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
--data '{
    "status": "pending",
    "packageCustomerId": null
}'
リクエスト
{
    "message": "Successfully updated appointment status",
    "data": {
        "appointment": {
            "id": 742,
            "bookings": [
                {
                    "id": 979,
                    "customerId": 10,
                    "customer": null,
                    "status": "pending",
                    "extras": [],
                    "couponId": null,
                    "price": 23,
                    "coupon": null,
                    "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                    "info": null,
                    "appointmentId": 742,
                    "persons": 2,
                    "token": null,
                    "payments": [
                        {
                            "id": 1000,
                            "customerBookingId": 979,
                            "packageCustomerId": null,
                            "parentId": null,
                            "amount": 0,
                            "gateway": "onSite",
                            "gatewayTitle": "",
                            "dateTime": "2023-10-05 13:00:00",
                            "status": "pending",
                            "data": "",
                            "entity": null,
                            "created": null,
                            "actionsCompleted": null,
                            "wcOrderId": null,
                            "wcOrderUrl": null,
                            "wcItemCouponValue": null,
                            "wcItemTaxValue": null,
                            "transactionId": null
                        }
                    ],
                    "utcOffset": null,
                    "aggregatedPrice": true,
                    "isChangedStatus": false,
                    "isLastBooking": null,
                    "packageCustomerService": null,
                    "ticketsData": [],
                    "duration": 1800,
                    "created": "2023-09-26 10:19:00",
                    "actionsCompleted": null,
                    "isUpdated": null
                }
            ],
            "notifyParticipants": 1,
            "internalNotes": "",
            "status": "pending",
            "serviceId": 1,
            "parentId": null,
            "providerId": 1,
            "locationId": 2,
            "provider": null,
            "service": null,
            "location": null,
            "googleCalendarEventId": "hlda2snvbh7llqbupsgnels3io",
            "googleMeetUrl": null,
            "outlookCalendarEventId": null,
            "zoomMeeting": null,
            "lessonSpace": null,
            "bookingStart": "2023-10-05 11:00:00",
            "bookingEnd": "2023-10-05 11:30:00",
            "type": "appointment",
            "isRescheduled": null,
            "isFull": null,
            "resources": []
        },
        "bookingsWithChangedStatus": [],
        "status": "pending",
        "oldStatus": "pending",
        "message": "Appointment status has been changed to pending"
    }
}

予約の取得

予約の詳細を取得します。

メソッド

このエンドポイントはGETリクエストを受け付けます。

パス

appointments/{{appointment_id}}

レスポンス
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments/742'
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
リクエスト
{
    "message": "Successfully retrieved appointment",
    "data": {
        "appointment": {
            "id": 742,
            "bookings": [
                {
                    "id": 979,
                    "customerId": 10,
                    "customer": null,
                    "status": "pending",
                    "extras": [],
                    "couponId": null,
                    "price": 23,
                    "coupon": null,
                    "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                    "info": null,
                    "appointmentId": 742,
                    "persons": 2,
                    "token": null,
                    "payments": [
                        {
                            "id": 1000,
                            "customerBookingId": 979,
                            "packageCustomerId": null,
                            "parentId": null,
                            "amount": 0,
                            "gateway": "onSite",
                            "gatewayTitle": "",
                            "dateTime": "2023-10-05 13:00:00",
                            "status": "pending",
                            "data": "",
                            "entity": null,
                            "created": null,
                            "actionsCompleted": null,
                            "wcOrderId": null,
                            "wcOrderUrl": null,
                            "wcItemCouponValue": null,
                            "wcItemTaxValue": null,
                            "transactionId": null
                        }
                    ],
                    "utcOffset": null,
                    "aggregatedPrice": true,
                    "isChangedStatus": null,
                    "isLastBooking": null,
                    "packageCustomerService": null,
                    "ticketsData": [],
                    "duration": 1800,
                    "created": "2023-09-26 10:19:00",
                    "actionsCompleted": null,
                    "isUpdated": null
                }
            ],
            "notifyParticipants": 1,
            "internalNotes": "",
            "status": "pending",
            "serviceId": 1,
            "parentId": null,
            "providerId": 1,
            "locationId": 2,
            "provider": null,
            "service": null,
            "location": null,
            "googleCalendarEventId": "hlda2snvbh7llqbupsgnels3io",
            "googleMeetUrl": null,
            "outlookCalendarEventId": null,
            "zoomMeeting": null,
            "lessonSpace": null,
            "bookingStart": "2023-10-05 11:00:00",
            "bookingEnd": "2023-10-05 11:30:00",
            "type": "appointment",
            "isRescheduled": null,
            "isFull": null,
            "resources": []
        },
        "recurring": []
    }
}

複数の予約の取得

複数の予約の詳細を取得します。

メソッド

このエンドポイントはGETリクエストを受け付けます。

パス

appointments

キータイプ説明
datesstring予約を取得する開始日と終了日。
pageintegerページ番号。制限は基本設定で定められています。
skipServicesbooleanサービスの詳細も取得するかどうか。
skipProvidersbooleanスタッフの詳細も取得するかどうか。
asArrayboolean取得された予約が配列形式になるかどうか。デフォルトはFalseで、キーが予約日であるオブジェクトとして送信されます。

レスポンス
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments/742'
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
リクエスト
{
    "message": "Successfully retrieved appointment",
    "data": {
        "appointment": {
            "id": 742,
            "bookings": [
                {
                    "id": 979,
                    "customerId": 10,
                    "customer": null,
                    "status": "pending",
                    "extras": [],
                    "couponId": null,
                    "price": 23,
                    "coupon": null,
                    "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                    "info": null,
                    "appointmentId": 742,
                    "persons": 2,
                    "token": null,
                    "payments": [
                        {
                            "id": 1000,
                            "customerBookingId": 979,
                            "packageCustomerId": null,
                            "parentId": null,
                            "amount": 0,
                            "gateway": "onSite",
                            "gatewayTitle": "",
                            "dateTime": "2023-10-05 13:00:00",
                            "status": "pending",
                            "data": "",
                            "entity": null,
                            "created": null,
                            "actionsCompleted": null,
                            "wcOrderId": null,
                            "wcOrderUrl": null,
                            "wcItemCouponValue": null,
                            "wcItemTaxValue": null,
                            "transactionId": null
                        }
                    ],
                    "utcOffset": null,
                    "aggregatedPrice": true,
                    "isChangedStatus": null,
                    "isLastBooking": null,
                    "packageCustomerService": null,
                    "ticketsData": [],
                    "duration": 1800,
                    "created": "2023-09-26 10:19:00",
                    "actionsCompleted": null,
                    "isUpdated": null
                }
            ],
            "notifyParticipants": 1,
            "internalNotes": "",
            "status": "pending",
            "serviceId": 1,
            "parentId": null,
            "providerId": 1,
            "locationId": 2,
            "provider": null,
            "service": null,
            "location": null,
            "googleCalendarEventId": "hlda2snvbh7llqbupsgnels3io",
            "googleMeetUrl": null,
            "outlookCalendarEventId": null,
            "zoomMeeting": null,
            "lessonSpace": null,
            "bookingStart": "2023-10-05 11:00:00",
            "bookingEnd": "2023-10-05 11:30:00",
            "type": "appointment",
            "isRescheduled": null,
            "isFull": null,
            "resources": []
        },
        "recurring": []
    }
}

予約の削除

予約の詳細を削除します。

メソッド

このエンドポイントはDELETEリクエストを受け付けます。

パス

appointments/{{appointment_id}}

レスポンス
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments/delete/173'
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
リクエスト
{
    "message": "Successfully deleted appointment",
    "data": {
        "appointment": {
            "id": 173,
            "bookings": [
                {
                    "id": 254,
                    "customerId": 10,
                    "customer": null,
                    "status": "rejected",
                    "extras": [],
                    "couponId": null,
                    "price": 20,
                    "coupon": null,
                    "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                    "info": null,
                    "appointmentId": 173,
                    "persons": 1,
                    "token": null,
                    "payments": [
                        {
                            "id": 295,
                            "customerBookingId": 254,
                            "packageCustomerId": null,
                            "parentId": null,
                            "amount": 0,
                            "gateway": "onSite",
                            "gatewayTitle": "",
                            "dateTime": "2023-05-11 09:00:00",
                            "status": "pending",
                            "data": "",
                            "entity": null,
                            "created": null,
                            "actionsCompleted": null,
                            "wcOrderId": null,
                            "wcOrderUrl": null,
                            "wcItemCouponValue": null,
                            "wcItemTaxValue": null
                        }
                    ],
                    "utcOffset": null,
                    "aggregatedPrice": true,
                    "isChangedStatus": true,
                    "isLastBooking": null,
                    "packageCustomerService": null,
                    "ticketsData": [],
                    "duration": 1800,
                    "created": null,
                    "actionsCompleted": null
                }
            ],
            "notifyParticipants": 1,
            "internalNotes": "",
            "status": "rejected",
            "serviceId": 1,
            "parentId": null,
            "providerId": 1,
            "locationId": 1,
            "provider": null,
            "service": null,
            "location": null,
            "googleCalendarEventId": null,
            "googleMeetUrl": null,
            "outlookCalendarEventId": null,
            "zoomMeeting": null,
            "lessonSpace": null,
            "bookingStart": "2023-05-11 09:00:00",
            "bookingEnd": "2023-05-11 09:30:00",
            "type": "appointment",
            "isRescheduled": null,
            "resources": []
        },
        "bookingsWithChangedStatus": [
            {
                "id": 254,
                "customerId": 10,
                "customer": null,
                "status": "pending",
                "extras": [],
                "couponId": null,
                "price": 20,
                "coupon": null,
                "customFields": "{\"1\":{\"label\":\"text\",\"value\":\"\",\"type\":\"text\"}}",
                "info": null,
                "appointmentId": 173,
                "persons": 1,
                "token": null,
                "payments": [
                    {
                        "id": 295,
                        "customerBookingId": 254,
                        "packageCustomerId": null,
                        "parentId": null,
                        "amount": 0,
                        "gateway": "onSite",
                        "gatewayTitle": "",
                        "dateTime": "2023-05-11 09:00:00",
                        "status": "pending",
                        "data": "",
                        "entity": null,
                        "created": null,
                        "actionsCompleted": null,
                        "wcOrderId": null,
                        "wcOrderUrl": null,
                        "wcItemCouponValue": null,
                        "wcItemTaxValue": null
                    }
                ],
                "utcOffset": null,
                "aggregatedPrice": true,
                "isChangedStatus": true,
                "isLastBooking": null,
                "packageCustomerService": null,
                "ticketsData": [],
                "duration": 1800,
                "created": null,
                "actionsCompleted": null
            }
        ]
    }
}