

操作ガイド
ここでは、場所に関連する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リクエストを受け付けます。
パス
/locations
必須プロパティ
以下のプロパティは必須です。
| キー | タイプ | 説明 |
name | string | 場所の名前。 |
オプションのプロパティ
以下のプロパティはオプションです。
| キー | タイプ | 説明 |
status | string | 場所のステータス。使用可能な値:visible(表示)、hidden(非表示)、disabled(無効)。デフォルト値はvisibleです。 |
description | string | 場所の説明。 |
address | string | 場所の住所。 |
phone | string | 場所の電話番号。 |
latitude | float | 場所の緯度。デフォルト値は40.7484405です。 |
longitude | float | 場所の経度。デフォルト値は-73.9878531です。 |
pictureFullPath | string | 場所の画像のフルパス。 |
pictureThumbPath | string | 場所の画像のサムネイルパス。 |
pin | string | 場所のピンの画像のパス。デフォルトのピンアイコンは以下にあります:/public/img/pins/orange.png、/public/img/pins/green.png、/public/img/pins/purple.png、/public/img/pins/red.png |
translations | string | 場所の翻訳(JSON形式の文字列)。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/locations' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{ "status": "visible", "name": "169 West Drive", "description": "Description of location", "address": "169 West Drive, Northlake, IL, USA", "phone": "+381601234567", "latitude": 41.9086589, "longitude": -87.9121619, "pictureFullPath": "", "pictureThumbPath": "", "pin": "http://localhost/amelia/wp-content/plugins/amelia-plugin/public/img/pins/orange.png", "translations": "{\"name\":{\"fr_FR\":\"nom de la localisation\"},\"description\":{\"fr_FR\":\"description du lieu\",\"fr_FRHtml\":\"description du lieu\"}}" }'
{
"message": "Successfully added location.",
"data": {
"location": {
"id": 11,
"status": "visible",
"name": "169 West Drive",
"description": "Description of location",
"address": "169 West Drive, Northlake, IL, USA",
"phone": "+381601234567",
"latitude": 41.9086589,
"longitude": -87.9121619,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": "http://localhost/amelia/wp-content/plugins/amelia-plugin/public/img/pins/orange.png",
"translations": "{\"name\":{\"fr_FR\":\"nom de la localisation\"},\"description\":{\"fr_FR\":\"description du lieu\",\"fr_FRHtml\":\"description du lieu\"}}"
}
}
}
場所詳細を更新します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/locations/{{location_id}}
オプションのプロパティ
更新したいプロパティのみを送信してください。
| キー | タイプ | 説明 |
name | string | 場所の名前。 |
status | string | 場所のステータス。使用可能な値:visible(表示)、hidden(非表示)、disabled(無効)。デフォルト値はvisibleです。 |
description | string | 場所の説明。 |
address | string | 場所の住所。 |
phone | string | 場所の電話番号。 |
latitude | float | 場所の緯度。デフォルト値は40.7484405です。 |
longitude | float | 場所の経度。デフォルト値は-73.9878531です。 |
pictureFullPath | string | 場所の画像のフルパス。 |
pictureThumbPath | string | 場所の画像のサムネイルパス。 |
pin | string | 場所のピンの画像のパス。デフォルトのピンアイコンは以下にあります:/public/img/pins/orange.png、/public/img/pins/green.png、/public/img/pins/purple.png、/public/img/pins/red.png |
translations | string | 場所の翻訳(JSON形式の文字列)。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/locations/11' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{ "status": "visible", "name": "169 West Drive", "description": "Description of location", "address": "169 W North Ave, Northlake, IL, USA", "phone": "+381601234567", "latitude": 41.9068764, "longitude": -87.89629680000002, "pictureFullPath": null, "pictureThumbPath": null, "pin": null, "translations": null }'
{
"message": "Successfully updated location.",
"data": {
"location": {
"id": 11,
"status": "visible",
"name": "169 West Drive",
"description": "Description of location",
"address": "169 W North Ave, Northlake, IL, USA",
"phone": "+381601234567",
"latitude": 41.9068764,
"longitude": -87.89629680000002,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": "http://localhost/amelia/wp-content/plugins/amelia-plugin//public/img/pins/orange.png",
"translations": null
}
}
}
場所の詳細を取得します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/locations/{{location_id}}
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/locations/11' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully retrieved location.",
"data": {
"location": {
"id": 11,
"status": "visible",
"name": "169 West Drive",
"description": "Description of location",
"address": "169 West Drive, Northlake, IL, USA",
"phone": "+381601234567",
"latitude": 41.908659,
"longitude": -87.912162,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": "http://localhost/amelia/wp-content/plugins/amelia-plugin/public/img/pins/orange.png",
"translations": "{\"name\":{\"fr_FR\":\"nom de la localisation\"},\"description\":{\"fr_FR\":\"description du lieu\",\"fr_FRHtml\":\"description du lieu\"}}"
}
}
}
将来の予約に基づいて、場所を安全に削除できるかどうかを確認します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/locations/effect/{{location_id}}
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/locations/effect/11' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully retrieved message.",
"data": {
"valid": true,
"message": ""
}
}
場所を取得します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/locations
オプションのプロパティ
場所のページング/並べ替えのために、以下のクエリパラメータを使用できます。
| キー | タイプ | 説明 |
page | integer | 返される場所のページ。 |
sort | string | 並べ替え順序。使用可能な値:name、-name、address、-address。マイナス記号は降順を示します。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/locations&page=1&sort=name' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully retrieved locations.",
"data": {
"locations": [
{
"id": 11,
"status": "visible",
"name": "169 West Drive",
"description": "Description of location",
"address": "169 West Drive, Northlake, IL, USA",
"phone": "+381601234567",
"latitude": 41.908659,
"longitude": -87.912162,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": "http://localhost/amelia/wp-content/plugins/amelia-plugin/public/img/pins/orange.png",
"translations": "{\"name\":{\"fr_FR\":\"nom de la localisation\"},\"description\":{\"fr_FR\":\"description du lieu\",\"fr_FRHtml\":\"description du lieu\"}}"
},
{
"id": 4,
"status": "visible",
"name": "179 West Drive",
"description": "Description of location",
"address": "169 W North Ave, Northlake, IL, USA",
"phone": "+381601234567",
"latitude": 41.906876,
"longitude": -87.896297,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": null,
"translations": null
},
{
"id": 2,
"status": "visible",
"name": "Location2",
"description": "",
"address": "Velisava Vulovića 18, Belgrade, Serbia",
"phone": "",
"latitude": 44.767476,
"longitude": 20.455081,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": "",
"translations": null
}
],
"countFiltered": 5,
"countTotal": 5
}
}
場所を削除します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/locations/delete/{{location_id}}
例:
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/locations/delete/11' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully deleted location.",
"data": {
"location": {
"id": 11,
"status": "visible",
"name": "169 West Drive",
"description": "Description of location",
"address": "169 West Drive, Northlake, IL, USA",
"phone": "+381601234567",
"latitude": 41.908659,
"longitude": -87.912162,
"pictureFullPath": null,
"pictureThumbPath": null,
"pin": "http://localhost/amelia/wp-content/plugins/amelia-plugin/public/img/pins/orange.png",
"translations": "{\"name\":{\"fr_FR\":\"nom de la localisation\"},\"description\":{\"fr_FR\":\"description du lieu\",\"fr_FRHtml\":\"description du lieu\"}}"
}
}
}