

操作ガイド
ここでは、追加オプションに関連する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リクエストを受け付けます。
パス
/extras
必須プロパティ
以下のプロパティは必須です。
| キー | タイプ | 説明 |
name | string | 追加オプションの名前。 |
price | float | 追加オプションの価格。 |
serviceId | integer | 追加オプションが属するサービスのID。 |
オプションのプロパティ
以下のプロパティはオプションです。
| キー | タイプ | 説明 |
duration | integer | 追加オプションの所要時間(秒単位)。 |
description | string | 追加オプションの説明。 |
maxQuantity | integer | 追加オプションの最大数量。デフォルト値は1です。 |
position | integer | 追加オプションの位置(並べ替えに関連)。デフォルト値は1です。 |
translations | string | 翻訳用のJSON形式の文字列。 |
aggregatedPrice | boolean | 追加オプションの価格が人数によって乗算されるかどうか。デフォルト値はfalseです。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/extras' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{ "name": "Extra", "price": 20, "duration": 1800, "description": "Extra description", "maxQuantity": 1, "position": 1, "translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}", "aggregatedPrice": 0, "serviceId": 1 }'
{
"message": "Successfully added new service extra.",
"data": {
"extra": {
"id": 25,
"name": "Extra",
"description": "Extra description",
"price": 20,
"maxQuantity": 1,
"position": 1,
"duration": 1800,
"serviceId": 1,
"aggregatedPrice": false,
"translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}"
}
}
}
追加オプション詳細を更新します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/extras/{{extra_id}}
オプションのプロパティ
更新したいプロパティのみを送信してください。
| キー | タイプ | 説明 |
name | string | 追加オプションの名前。 |
price | float | 追加オプションの価格。 |
serviceId | integer | 追加オプションが属するサービスのID。 |
duration | integer | 追加オプションの所要時間(秒単位)。 |
description | string | 追加オプションの説明。 |
maxQuantity | integer | 追加オプションの最大数量。デフォルト値は1です。 |
position | integer | 追加オプションの位置(並べ替えに関連)。デフォルト値は1です。 |
translations | string | 翻訳用のJSON形式の文字列。 |
aggregatedPrice | boolean | 追加オプションの価格が人数によって乗算されるかどうか。デフォルト値はfalseです。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/extras/25' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{ "name": "Extra 2", "duration": 1800, "price": 25, "description": "Extra description", "maxQuantity": 1, "position": 1, "translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}", "aggregatedPrice": 1, "serviceId": 1 }'
{
"message": "Successfully updated bookable extra.",
"data": {
"extra": {
"id": 25,
"name": "Extra 2",
"description": "Extra description",
"price": 25,
"maxQuantity": 1,
"position": 1,
"duration": 1800,
"serviceId": 1,
"aggregatedPrice": true,
"translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}"
}
}
}
追加オプション詳細を取得します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/extras/{{extra_id}}
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/extras/25' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully retrieved extra",
"data": {
"extra": {
"id": 25,
"name": "Extra 2",
"description": "Extra description",
"price": 25,
"maxQuantity": 1,
"position": 1,
"duration": 1800,
"serviceId": 1,
"aggregatedPrice": true,
"translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}"
}
}
}
追加オプション詳細を取得します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/extras
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/extras' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully retrieved extras.",
"data": {
"extras": [
{
"id": 5,
"name": "extra1",
"description": "",
"price": 20,
"maxQuantity": 1,
"position": 1,
"duration": null,
"serviceId": 6,
"aggregatedPrice": false,
"translations": null
},
{
"id": 6,
"name": "extra2",
"description": "",
"price": 0,
"maxQuantity": 3,
"position": 2,
"duration": 1800,
"serviceId": 6,
"aggregatedPrice": false,
"translations": null
},
{
"id": 25,
"name": "Extra 2",
"description": "Extra description",
"price": 25,
"maxQuantity": 1,
"position": 1,
"duration": 1800,
"serviceId": 1,
"aggregatedPrice": true,
"translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}"
}
]
}
}
追加オプションを削除します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/extras/delete/{{extra_id}}
例:
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/extras/delete/25' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully deleted bookable extra.",
"data": {
"extra": {
"id": 25,
"name": "Extra 2",
"description": "Extra description",
"price": 25,
"maxQuantity": 1,
"position": 1,
"duration": 1800,
"serviceId": 1,
"aggregatedPrice": true,
"translations": "{\"name\":{\"fr_FR\":\"supplémentaire\"},\"description\":{\"fr_FR\":\"description du supplément\",\"fr_FRHtml\":\"description du supplément\"}}"
}
}
}