MENU

料金プラン

機能一覧

デモ

ご利用の流れ

お役立ちコラム



お客様

操作ガイド

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リクエストを受け付けます。

パス

/users/customers

必須プロパティ

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

キータイプ説明
firstNamestringお客様の名。
lastNamestringお客様の姓。

オプションのプロパティ

以下のプロパティはオプションです。

キータイプ説明
externalIdintegerAmeliaお客様に接続されているWPユーザーID。
phonestringお客様の電話番号。
countryPhoneIsostring電話番号に関連付けられた国別電話ISO。
emailstringお客様メールメールは一意である必要があります。
genderstringお客様の性別。使用可能な値:male(男性)、female(女性)。
birthdaystringお客様の誕生日。形式:YYYY-MM-DD
notestringお客様のメモ。
languagestringお客様のデフォルト言語。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data-raw '{ "firstName": "Amelia", "lastName": "Amelia", "externalId": 16, "phone": "+381601234567", "countryPhoneIso": "rs", "email": "amelia@test.test", "gender": "female", "birthday": "1990-05-17", "note": "Note about customer", "language": "en_GB" }'
レスポンス
{
"message": "Successfully added new user.",
"data": {
"user": {
"id": 23,
"firstName": "Amelia",
"lastName": "Amelia",
"birthday": {
"date": "1990-05-17 13:38:49.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"email": "amelia@test.test",
"phone": "+381601234567",
"type": "customer",
"status": "visible",
"note": "Note about customer",
"zoomUserId": null,
"countryPhoneIso": "rs",
"externalId": 16,
"pictureFullPath": null,
"pictureThumbPath": null,
"translations": "{\"defaultLanguage\":\"en_GB\"}",
"gender": "female"
}
}
}

お客様の更新

お客様の詳細を更新します。

メソッド

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

パス

/users/customers/{{customer_id}}

オプションのプロパティ

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

キータイプ説明
firstNamestringお客様の名。
lastNamestringお客様の姓。
externalIdintegerAmeliaお客様に接続されているWPユーザーID。
phonestringお客様の電話番号。
countryPhoneIsostring電話番号に関連付けられた国別電話ISO。
emailstringお客様メールメールは一意である必要があります。
genderstringお客様の性別。使用可能な値:male(男性)、female(女性)。
birthdaystringお客様の誕生日。形式:YYYY-MM-DD
notestringお客様のメモ。
languagestringお客様のデフォルト言語。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/23' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data-raw '{ "firstName": "Amelia", "lastName": "New Last Name", "externalId": 16, "phone": "+381601234567", "countryPhoneIso": "rs", "email": "amelia1@test.test", "gender": "female", "birthday": "1990-05-17", "note": "Note about customer", "language": "en_GB" }'
レスポンス
{
"message": "Successfully updated user",
"data": {
"user": {
"id": 23,
"firstName": "Amelia",
"lastName": "New Last Name",
"birthday": {
"date": "1990-05-17 13:40:33.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"email": "amelia1@test.test",
"phone": "+381601234567",
"type": "customer",
"status": "visible",
"note": "Note about customer",
"zoomUserId": null,
"countryPhoneIso": "rs",
"externalId": 16,
"pictureFullPath": null,
"pictureThumbPath": null,
"translations": "{\"defaultLanguage\":\"en_GB\"}",
"gender": "female"
},
"is_wp_user": false
}
}

お客様の取得

お客様の詳細を取得します。

メソッド

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

パス

/users/customers/{{customer_id}}

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/23' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully retrieved user",
"data": {
"user": {
"id": 23,
"firstName": "Amelia",
"lastName": "New Last Name",
"birthday": {
"date": "1990-05-17 18:57:49.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"email": "amelia1@test.test",
"phone": "+381601234567",
"type": "customer",
"status": "visible",
"note": "Note about customer",
"zoomUserId": null,
"countryPhoneIso": "rs",
"externalId": 16,
"pictureFullPath": null,
"pictureThumbPath": null,
"translations": "{\"defaultLanguage\":\"en_GB\"}",
"gender": "female"
}
}
}

お客様削除の影響の取得

将来の予約に基づいて、お客様を安全に削除できるかどうかを確認します。

メソッド

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

パス

/users/customers/effect/{{customer_id}}

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/effect/23' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully retrieved message.",
"data": {
"valid": false,
"message": "Could not delete user.\n This user has 7 appointments in the future."
}
}

複数のお客様の取得

お客様を取得します。

メソッド

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

パス

/customers

オプションのプロパティ

場所のページング/並べ替えのために、以下のクエリパラメータを使用できます。

キータイプ説明
pageinteger返される場所のページ。
searchstring検索語。検索対象には、名、姓、メール、メモが含まれます。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers&page=1&search=amelia' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully retrieved users.",
"data": {
"users": [
{
"id": 10,
"status": "visible",
"firstName": "Amelia",
"lastName": "Test",
"email": "ameliatest@test.test",
"phone": "+381631652656",
"countryPhoneIso": "rs",
"gender": "",
"externalId": 8,
"translations": "{\"defaultLanguage\":\"en_US\"}",
"birthday": "",
"note": "",
"lastAppointment": "2023-05-03 15:00:00",
"totalAppointments": 11,
"countPendingAppointments": "0",
"wpName": "ameliatesttest-test",
"wpUserPhotoUrl": "http://0.gravatar.com/avatar/6badf27972c65effc8ae7aefca4ff870?s=96&d=mm&r=g"
},
...
],
"filteredCount": 3,
"totalCount": 16
}
}

お客様の削除

お客様を削除します。

メソッド

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

パス

/users/customers/delete/{{customer_id}}

リクエスト
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/users/customers/delete/23' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully deleted user.",
"data": []
}
}