Don’t miss our Special Offer!

Up to 50% off
Grab Amelia
Grab Amelia

Amelia API – Locations

Here you can see API endpoints related to locations.

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 Developer 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 location

Create a location.

Method

This endpoint accepts POST requests.

Path

/locations

Required Properties

The following properties are required.

Key Type Description
name string The name of the location.

Optional Properties

The following properties are optional

Key Type Description
status string The status of the location. Possible values: visible, hidden, disabled. The default values id visible
description
string The description of the location.
address
string The address of the location.
phone
string The phone number for the location.
latitude
float The latitude of the location. The default value is 40.7484405
longitude
float The longitude of the location. The default value is -73.9878531
pictureFullPath
string The path for the picture of the location.
pictureThumbPath
string The path for the picture of the location.
pin
string The path for the picture of the pin location. The default pin icons are located at:

/public/img/pins/orange.png, /public/img/pins/green.png, /public/img/pins/purple.png, /public/img/pins/red.png
translations
string JSON encoded string of the location translations.

Example

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

Update location

Update location details.

Method

This endpoint accepts POST requests.

Path

/locations/{{location_id}}

Optional Properties

Send only the properties you want updated.

Key Type Description
name
string The name of the location.
status string The status of the location. Possible values: “visible”, “hidden”, “disabled”. The default value is “visible”.
description
string The description of the location.
address
string The address of the location.
phone
string The phone number for the location.
latitude
float The latitude of the location. The default value is 40.7484405
longitude
float The longitude of the location. The default value is -73.9878531
pictureFullPath
string The path for the picture of the location.
pictureThumbPath
string The path for the picture of the location.
pin
string The path for the picture of the pin location. The default pin icons are located at:

/public/img/pins/orange.png, /public/img/pins/green.png, /public/img/pins/purple.png, /public/img/pins/red.png
translations
string JSON encoded string of the location translations.

Example

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 location

Retrieve location details.

Method

This endpoint accepts GET requests.

Path

/locations/{{location_id}}

Example

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 location delete effect

See if the location can be deleted safely, based on future appointments.

Method

This endpoint accepts GET requests.

Path

/locations/effect/{{location_id}}

Example

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

Retrieve locations.

Method

This endpoint accepts GET requests.

Path

/locations

Optional Properties

You can use the following query parameters for paging/sorting the locations.

Key Type Description
page
integer The page of the returned locations
sort string The sorting order. Possible values: name, -name, address, -address. The minus indicated a descending order.

Example

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

Delete location

Delete location.

Method

This endpoint accepts POST requests.

Path

/locations/delete/{{location_id}}

Example

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