Don’t miss our Special Offer!

Up to 50% off
Grab Amelia
Grab Amelia

Amelia API – Custom fields

Here you can see API endpoints related to custom fields.

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 custom field

Create a custom field.

Method

This endpoint accepts POST requests.

Path

/fields

Required Properties

The following properties are required.

Key Type Description
type string The type of the custom field. Possible values: ‘text’, ‘text-area’, ‘select’, ‘checkbox’, ‘radio’, ‘content’, ‘file’, ‘datepicker’, ‘address’

Optional Properties

The following properties are optional

Key Type Description
label string The label of the custom field.
options
array An array of options. Used for the select, radio type
position
integer The position of the custom field used for sorting. The default value is 1.
required
boolean Whether the custom field is required. False by default.
services
array An array of service ids.
events
array An array of event ids.
useAsLocation
boolean Whether the custom field should be used as the location in the google/outlook calendar event. Used only with address custom field

Example

curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/fields' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
    "label": "Select custom field",
    "options": [],
    "position": 3,
    "required": false,
    "services": [
         {
            "id": 1
        }
    ],
    "events": [
         {
            "id": 120
        }
    ],
    "type": "select",
    "useAsLocation": false 
}'
{
    "message": "Successfully added new custom field.",
    "data": {
        "customField": {
            "id": 15,
            "label": "Select custom field",
            "type": "select",
            "required": false,
            "position": 3,
            "options": [],
            "services": [
                {
                    "id": 1,
                    "name": null,
                    "description": null,
                    "color": null,
                    "price": null,
                    "deposit": null,
                    "depositPayment": null,
                    "depositPerPerson": null,
                    "pictureFullPath": null,
                    "pictureThumbPath": null,
                    "extras": [],
                    "coupons": [],
                    "position": null,
                    "settings": null,
                    "fullPayment": null,
                    "minCapacity": null,
                    "maxCapacity": null,
                    "duration": null,
                    "timeBefore": null,
                    "timeAfter": null,
                    "bringingAnyone": null,
                    "show": null,
                    "aggregatedPrice": null,
                    "status": null,
                    "categoryId": null,
                    "category": null,
                    "priority": [],
                    "gallery": [],
                    "recurringCycle": null,
                    "recurringSub": null,
                    "recurringPayment": null,
                    "translations": null,
                    "minSelectedExtras": null,
                    "mandatoryExtra": null,
                    "customPricing": null,
                    "maxExtraPeople": null,
                    "limitPerCustomer": null
                }
            ],
            "events": [
                {
                    "id": 120,
                    "name": null,
                    "description": null,
                    "color": null,
                    "price": null,
                    "deposit": null,
                    "depositPayment": null,
                    "depositPerPerson": null,
                    "pictureFullPath": null,
                    "pictureThumbPath": null,
                    "extras": [],
                    "coupons": [],
                    "position": null,
                    "settings": null,
                    "fullPayment": null,
                    "bookings": [],
                    "periods": [],
                    "bookingOpens": null,
                    "bookingCloses": null,
                    "bookingOpensRec": null,
                    "bookingClosesRec": null,
                    "ticketRangeRec": null,
                    "status": null,
                    "recurring": null,
                    "maxCapacity": null,
                    "maxCustomCapacity": null,
                    "show": null,
                    "tags": [],
                    "customTickets": [],
                    "gallery": [],
                    "providers": [],
                    "notifyParticipants": null,
                    "locationId": null,
                    "location": null,
                    "customLocation": null,
                    "parentId": null,
                    "created": null,
                    "zoomUserId": null,
                    "organizerId": null,
                    "type": "event",
                    "bringingAnyone": null,
                    "bookMultipleTimes": null,
                    "translations": null,
                    "customPricing": null,
                    "closeAfterMin": null,
                    "closeAfterMinBookings": null,
                    "maxExtraPeople": null,
                    "initialEventStart": null,
                    "initialEventEnd": null,
                    "aggregatedPrice": null
                }
            ],
            "translations": null,
            "allServices": false,
            "allEvents": false,
            "useAsLocation": false
        }
    }
}

Update custom field

Update custom field.

Method

This endpoint accepts POST requests.

Path

/fields/{{field_id}}

Optional Properties

Send only the properties you want updated.

Key Type Description
type
string The type of the custom field. Possible values: ‘text’, ‘text-area’, ‘select’, ‘checkbox’, ‘radio’, ‘content’, ‘file’, ‘datepicker’, ‘address’
label string The label of the custom field.
options
array An array of options. Used for the select, radio type
position
integer The position of the custom field used for sorting. The default value is 1.
required
boolean Whether the custom field is required. False by default.
services
array An array of service ids.
events
array An array of event ids.
useAsLocation
boolean Whether the custom field should be used as the location in the google/outlook calendar event. Used only with address custom field
translations
string JSON encoded string for the translation of the label
allServices
boolean Whether the custom field is for every service. False by default.
allEvents
boolean Whether the custom field is for every event. False by default.

Example

curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/fields/11' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
    "label": "Select custom field",
    "type": "select",
    "required": false,
    "position": 3,
    "options": [
        {
            "deleted": false,
            "edited": false,
            "label": "Select Option",
            "new": true,
            "position": 1
        }
    ],
    "services": [
        {
            "id": 1
        }
    ],
    "events": [],
    "translations": null,
    "allServices": false,
    "allEvents": false,
    "useAsLocation": false 
}'
{
    "message": "Custom field successfully updated.",
    "data": {
        "customField": {
            "id": 11,
            "label": "Select custom field",
            "type": "select",
            "required": false,
            "position": 3,
            "options": [
                {
                    "id": 6,
                    "customFieldId": 3,
                    "label": "Select Option",
                    "position": 1,
                    "translations": null
                }
            ],
            "services": [
                {
                    "id": 1,
                    "name": null,
                    "description": null,
                    "color": null,
                    "price": null,
                    "deposit": null,
                    "depositPayment": null,
                    "depositPerPerson": null,
                    "pictureFullPath": null,
                    "pictureThumbPath": null,
                    "extras": [],
                    "coupons": [],
                    "position": null,
                    "settings": null,
                    "fullPayment": null,
                    "minCapacity": null,
                    "maxCapacity": null,
                    "duration": null,
                    "timeBefore": null,
                    "timeAfter": null,
                    "bringingAnyone": null,
                    "show": null,
                    "aggregatedPrice": null,
                    "status": null,
                    "categoryId": null,
                    "category": null,
                    "priority": [],
                    "gallery": [],
                    "recurringCycle": null,
                    "recurringSub": null,
                    "recurringPayment": null,
                    "translations": null,
                    "minSelectedExtras": null,
                    "mandatoryExtra": null,
                    "customPricing": null,
                    "maxExtraPeople": null,
                    "limitPerCustomer": null
                }
            ],
            "events": [],
            "translations": null,
            "allServices": false,
            "allEvents": false,
            "useAsLocation": false
        }
    }
}

Update custom field positions

Update custom field positions.

Method

This endpoint accepts POST requests.

Path

/fields/positions

Required Properties

The following properties are required.

Key Type Description
customFields array An array of the new custom fields positions

Example

curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/fields/positions' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
    "customFields": [
        {
            "id": 1,
            "position": 1
        },
        {
            "id": 3,
            "position": 2
        },
        {
            "id": 2,
            "position": 3
        }
    ]
}'
{
    "message": "Successfully updated custom fields positions.",
    "data": null
}

Get custom fields

Retrieve custom fields.

Method

This endpoint accepts GET requests.

Path

/fields

Example

curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/fields' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
    "message": "Successfully retrieved custom fields.",
    "data": {
        "customFields": [
            {
                "id": 1,
                "label": "text",
                "type": "text",
                "required": false,
                "position": 1,
                "options": [],
                "services": [],
                "events": [],
                "translations": null,
                "allServices": true,
                "allEvents": true
            }
        ]
    }
}

Delete custom field

Delete custom field.

Method

This endpoint accepts POST requests.

Path

/fields/delete/{{field_id}}

Example

curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/fields/delete/3' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
    "message": "Successfully deleted custom field.",
    "data": null
}