

操作ガイド
ここでは、統計に関連する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リクエストを受け付けます。
パス
/stats
必須プロパティ
以下のプロパティは必須です。
| キー | タイプ | 説明 |
serviceId | integer | サービスID。 |
providerId | integer | スタッフID。 |
オプションのプロパティ
以下のプロパティはオプションです。
| キー | タイプ | 説明 |
locationId | integer | 場所ID。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/stats' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{ "serviceId": 1, "providerId": 3, "locationId": 2 }'
{
"message": "Successfully added stats.",
"data": null
}
統計を取得します。これらは、スタッフの統計情報のためにダッシュボードページで使用されます。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/stats
オプションのプロパティ
統計をフィルタリングするために、以下のクエリパラメータを使用できます。
| キー | タイプ | 説明 |
dates | string | 開始日と終了日。形式:startDate,endDate。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/stats&dates=2023-05-18%2C2023-05-19' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully retrieved appointments.",
"data": {
"count": {
"approved": 0,
"pending": 0
},
"selectedPeriodStats": {
"2023-11-04": {
"providers": {
"14": {
"count": 1,
"occupied": 30,
"revenue": 46.2,
"intervals": [
{
"time": [ 41400, 79800 ],
"services": []
}
]
}
},
"services": {
"1": {
"count": 1,
"occupied": 30,
"revenue": 46.2
}
}
}
},
"previousPeriodStats": {
"2023-11-03": {
"providers": {
"3": {
"count": 0,
"occupied": 0,
"revenue": 0,
"intervals": [
{
"time": [ 32400, 61200 ],
"services": []
}
]
},
"14": {
"count": 0,
"occupied": 0,
"revenue": 0,
"intervals": [
{
"time": [ 41400, 79800 ],
"services": []
}
]
},
"12": {
"count": 2,
"occupied": 60,
"revenue": 60.2,
"intervals": [
{
"time": [ 32400, 57600 ],
"services": []
}
]
}
},
"services": {
"1": {
"count": 2,
"occupied": 60,
"revenue": 60.2
}
},
"packages": {
"8": {
"count": 1,
"purchased": 0,
"occupied": 30,
"revenue": 0,
"intervals": []
}
}
}
},
"employeesStats": [
{
"id": 14,
"name": "New Employee",
"appointments": 1
}
],
"servicesStats": [
{
"id": 1,
"name": "amelia service",
"appointments": 1
}
],
"locationsStats": [
{
"id": 4,
"name": "179 West Drive",
"appointments": 1
}
],
"customersStats": {
"newCustomersCount": 0,
"returningCustomersCount": 1,
"totalPastPeriodCustomers": 2
},
"appointments": [
{
"id": 841,
"bookings": [
{
"id": 1133,
"customerId": 34,
"customer": {
"id": 34,
"firstName": "Viola",
"lastName": "Smith",
"birthday": null,
"email": "viola@smith.com",
"phone": null,
"type": "お客様",
"status": "visible",
"note": null,
"zoomUserId": null,
"countryPhoneIso": null,
"externalId": null,
"pictureFullPath": null,
"pictureThumbPath": null,
"translations": null,
"gender": null
},
"status": "approved",
"extras": [],
"couponId": null,
"price": 27,
"coupon": null,
"customFields": "{\"2\":{\"label\":\"Select1\",\"type\":\"select\",\"value\":\"\"},\"5\":{\"label\":\"text3\",\"type\":\"text\",\"value\":\"\"},\"7\":{\"label\":\"My address\",\"type\":\"address\",\"value\":\"\"},\"9\":{\"label\":\"address4\",\"type\":\"address\",\"value\":\"\"},\"11\":{\"label\":\"Select custom field\",\"type\":\"select\",\"value\":\"\"},\"13\":{\"label\":\"file\",\"type\":\"file\",\"value\":[]}}",
"info": "{\"firstName\":\"Viola\",\"lastName\":\"Smith\",\"phone\":null,\"locale\":\"en_US\",\"timeZone\":\"Europe\\/Belgrade\",\"urlParams\":null}",
"appointmentId": 841,
"persons": 1,
"token": null,
"payments": [
{
"id": 1140,
"customerBookingId": 1133,
"packageCustomerId": null,
"parentId": 1138,
"amount": 46.2,
"gateway": "wc",
"gatewayTitle": "Cash on delivery",
"dateTime": "2023-11-01 09:56:49",
"status": "partiallyPaid",
"data": "",
"entity": null,
"created": "2023-11-01 08:56:49",
"actionsCompleted": null,
"wcOrderId": 983,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": 4.2,
"transactionId": null
}
],
"utcOffset": null,
"aggregatedPrice": true,
"isChangedStatus": null,
"isLastBooking": null,
"packageCustomerService": null,
"ticketsData": [],
"duration": 1800,
"created": "2023-11-01 09:56:49",
"actionsCompleted": null,
"isUpdated": null
}
],
"notifyParticipants": 1,
"internalNotes": "",
"status": "approved",
"serviceId": 1,
"parentId": 831,
"providerId": 14,
"locationId": 4,
"provider": null,
"service": {
"id": 1,
"name": "amelia service",
"description": "location address: %location_address%",
"color": "#1788FB",
"price": 20,
"deposit": null,
"depositPayment": null,
"depositPerPerson": null,
"pictureFullPath": null,
"pictureThumbPath": null,
"extras": [],
"coupons": [],
"position": null,
"settings": "{\"payments\":{\"mollie\":{\"enabled\":true},\"paymentLinks\":{\"enabled\":true,\"changeBookingStatus\":false,\"redirectUrl\":null},\"onSite\":true,\"payPal\":{\"enabled\":true},\"stripe\":{\"enabled\":true},\"razorpay\":{\"enabled\":true},\"square\":{\"enabled\":true}},\"zoom\":{\"enabled\":true},\"lessonSpace\":{\"enabled\":true},\"activation\":{\"version\":\"6.7\"},\"general\":{\"minimumTimeRequirementPriorToCanceling\":null}}",
"fullPayment": null,
"minCapacity": 1,
"maxCapacity": 10,
"duration": 1800,
"timeBefore": 1800,
"timeAfter": 1800,
"bringingAnyone": null,
"show": null,
"aggregatedPrice": null,
"status": "visible",
"categoryId": 1,
"category": null,
"priority": [],
"gallery": [],
"recurringCycle": null,
"recurringSub": null,
"recurringPayment": null,
"translations": null,
"minSelectedExtras": null,
"mandatoryExtra": null,
"customPricing": null,
"maxExtraPeople": null,
"limitPerCustomer": null
},
"location": null,
"googleCalendarEventId": null,
"googleMeetUrl": null,
"outlookCalendarEventId": null,
"zoomMeeting": null,
"lessonSpace": null,
"bookingStart": "2023-11-04 12:00:00",
"bookingEnd": "2023-11-04 12:30:00",
"type": "appointment",
"isRescheduled": null,
"isFull": null,
"resources": [],
"cancelable": false,
"past": false
}
]
}
}