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

パス

/extras

必須プロパティ

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

キータイプ説明
namestring追加オプションの名前。
pricefloat追加オプションの価格。
serviceIdinteger追加オプションが属するサービスのID。

オプションのプロパティ

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

キータイプ説明
durationinteger追加オプションの所要時間(秒単位)。
descriptionstring追加オプションの説明。
maxQuantityinteger追加オプションの最大数量。デフォルト値は1です。
positioninteger追加オプションの位置(並べ替えに関連)。デフォルト値は1です。
translationsstring翻訳用のJSON形式の文字列。
aggregatedPriceboolean追加オプションの価格が人数によって乗算されるかどうか。デフォルト値は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}}

オプションのプロパティ

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

キータイプ説明
namestring追加オプションの名前。
pricefloat追加オプションの価格。
serviceIdinteger追加オプションが属するサービスのID。
durationinteger追加オプションの所要時間(秒単位)。
descriptionstring追加オプションの説明。
maxQuantityinteger追加オプションの最大数量。デフォルト値は1です。
positioninteger追加オプションの位置(並べ替えに関連)。デフォルト値は1です。
translationsstring翻訳用のJSON形式の文字列。
aggregatedPriceboolean追加オプションの価格が人数によって乗算されるかどうか。デフォルト値は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\"}}"
}
}
}