Don’t miss our Special Offer!

Up to 50% off
Grab Amelia
Grab Amelia

Amelia API – Extras

Here you can see API endpoints related to extras.

You can see all the API endpoints with examples of requests and responses in the Amelia API Postman collection which you can download here.

Please note: The API Endpoints are included only in the Elite license plans. Using API Endpoints requires a certain level of coding skills, and is not included in the provided support for the plugin.

Authorization

All Amelia endpoints use an API key authorization, using the header property named “Amelia”.

Path

Amelia API paths start with: {{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1

Add extra

Create an extra.

Method

This endpoint accepts POST requests.

Path

/extras

Required Properties

The following properties are required.

Key Type Description
name string The name of the extra.
price float The price of the extra.
serviceId
integer The id of the service which the extra belongs to.

Optional Properties

The following properties are optional

Key Type Description
duration integer The duration of the extra in seconds.
description
string The description of the extra.
maxQuantity
integer The maximum quantity of the extra. Default value is 1.
position
integer The position of the extra, related to sorting. The default value is 1.
translations
string JSON encoded string for translations.
aggregatedPrice
boolean Whether the extra price will be multiplied by the number of people. Default values is false.

Example

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\"}}"
        }
    }
}

Update extra

Update extra details.

Method

This endpoint accepts POST requests.

Path

/extras/{{extra_id}}

Optional Properties

Send only the properties you want updated.

Key Type Description
name string The name of the extra.
price float The price of the extra.
serviceId
integer The id of the service which the extra belongs to.
duration integer The duration of the extra in seconds.
description
string The description of the extra.
maxQuantity
integer The maximum quantity of the extra. Default value is 1.
position
integer The position of the extra, related to sorting. The default value is 1.
translations
string JSON encoded string for translations.
aggregatedPrice
boolean Whether the extra price will be multiplied by the number of people. Default values is false.

Example

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 extra

Retrieve extra details.

Method

This endpoint accepts GET requests.

Path

/extras/{{extra_id}}

Example

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

Retrieve extras details.

Method

This endpoint accepts GET requests.

Path

/extras

Example

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\"}}"
            }
        ]
    }
}

Delete extra

Delete extra.

Method

This endpoint accepts POST requests.

Path

/extras/delete/{{extra_id}}

Example

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\"}}"
        }
    }
}