Here you can see API endpoints related to resources.
You can see all the API endpoints with examples of requests and responses in the Amelia API Postman collection which you can download here.
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 resource
Create a resource.
Method
This endpoint accepts POST requests.
Path
/resources
Required Properties
The following properties are required.
Key | Type | Description |
---|---|---|
name | string | The name of the resource for internal usage. |
quantity
|
integer | The quantity of the resource. |
Optional Properties
The following properties are optional
Key | Type | Description |
---|---|---|
shared
|
string | The shared type of the resource. Possible values: “service”, “location”, NULL |
status
|
string | The status of the resource. Possible values: “hidden”, “visible”. Visible by default. |
entities
|
array | The array of entities tied to the resource. All entities by default. |
countAdditionalPeople
|
boolean | Whether the resource is counted for every person in the appointment or for every appointment |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/resources' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data '{ "name": "Resource1", "quantity": 8, "shared": null, "status": "visible", "entities": [ { "entityId": 1, "entityType": "service" } ] }'
{ "message": "Successfully added new resource.", "data": { "resource": { "id": 7, "name": "Resource1", "quantity": 8, "shared": false, "status": "visible", "entities": [ { "entityId": 1, "entityType": "service" } ], "countAdditionalPeople": null } } }
Update resource
Update resource details.
Method
This endpoint accepts POST requests.
Path
/resources/{{resource_id}}
Optional Properties
Send only the properties you want updated.
Key | Type | Description |
---|---|---|
name | string | The name of the resource for internal usage. |
quantity
|
integer | The quantity of the resource. |
shared
|
string | The shared type of the resource. Possible values: “service”, “location”, NULL |
status
|
string | The status of the resource. Possible values: “hidden”, “visible”. Visible by default. |
entities
|
array | The array of entities tied to the resource. All entities by default. |
countAdditionalPeople
|
boolean | Whether the resource is counted for every person in the appointment or for every appointment |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/resources/6' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data '{ "name": "Resource new name", "quantity": 10, "shared": null, "status": "visible", "entities": [ { "entityId": 2, "entityType": "service" } ] }'
{ "message": "Successfully updated resource.", "data": { "resource": { "id": 6, "name": "Resource new name", "quantity": 10, "shared": false, "status": "visible", "entities": [ { "entityId": 2, "entityType": "service" } ], "countAdditionalPeople": null } } }
Get resources
Retrieve resources.
Method
This endpoint accepts GET requests.
Path
/resources
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=?api/v1/resources' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved resources.", "data": { "resources": [ { "id": 4, "name": "res3", "quantity": 1, "shared": "location", "status": "hidden", "entities": { "20": { "id": 20, "resourceId": 4, "entityId": 13, "entityType": "service" }, "19": { "id": 19, "resourceId": 4, "entityId": 5, "entityType": "service" }, "18": { "id": 18, "resourceId": 4, "entityId": 7, "entityType": "service" }, "17": { "id": 17, "resourceId": 4, "entityId": 3, "entityType": "service" }, "16": { "id": 16, "resourceId": 4, "entityId": 2, "entityType": "service" }, "15": { "id": 15, "resourceId": 4, "entityId": 6, "entityType": "service" }, "14": { "id": 14, "resourceId": 4, "entityId": 1, "entityType": "service" } }, "countAdditionalPeople": null }, { "id": 6, "name": "Resource new name", "quantity": 10, "shared": false, "status": "visible", "entities": { "25": { "id": 25, "resourceId": 6, "entityId": 2, "entityType": "service" } }, "countAdditionalPeople": null }, { "id": 7, "name": "Resource1", "quantity": 8, "shared": false, "status": "visible", "entities": { "24": { "id": 24, "resourceId": 7, "entityId": 1, "entityType": "service" } }, "countAdditionalPeople": null } ] } }
Delete resource
Delete resource.
Method
This endpoint accepts POST requests.
Path
/resources/delete/{{resource_id}}