Hi there, Many of the projects that I work on which I could use Amelia for, I end up not using Amelia because your templates you have made do not fit the use case correctly and are not flexible enough to allow me to change them. So what I would like to do is to code my own templates - but in order to do that I need to know how to query the data stored in Amelia.
Normally I would query custom post types, custom taxonomies, custom fields etc, but it seems that the data created by Amelia is not stored in the 'Wordpress way'. Unless I am mistaken?
Hi Marko, thanks for your reply. I'm trying to understand more what you have sent me and also tried to query data via your API but nothing is working.
For example, I would like to query all of the 'Services' I have setup in Amelia, but I cannot see anywhere in your documentation where it explains how to do that.
I have used Chat GPT to try and help me code this and this is the snippet I am using:
if (is_wp_error($response)) { // Handle error $error_message = $response->get_error_message(); echo "Something went wrong: $error_message"; } else { // Process the data $data = json_decode(wp_remote_retrieve_body($response), true); if (!empty($data)) { // If you want to see the full structure of the fetched data, uncomment the next line. // echo '<pre>' . print_r($data, true) . '</pre>'; // Display just the count of services for now. echo 'Number of services fetched: ' . count($data); } else { echo 'No services found.'; } }
?>
I have of course here swapped my URL and my API key for dummy text.
This does not return any data, when I know that I have 15 services setup in Amelia. Please can you provide instructions on how to query the services setup in Amelia? Or at the very least how to get all of the ID's for the services
We just got the feedback from our colleagues and they have told us that the api key should be sent in the header property names "Amelia", not as an authorization token like in your example. Here is a php code snippet using cURL, to retrieve all the services (using localhost and a random apiKey: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0)
Hi Marko, so from the code snippet you have sent me I have now been able to make a code snippet which queries services and displays the service name, description and price which is great. However, I have also tried to display the category of each service but this does not seem to work (and I know that all of my services have been applied to various categories). So, I am guessing that I will need to look more at the 'amelia api all.postman.json' file you sent me. However, I have not used the 'Postman' system before and I was wondering if you can offer some guidance:
- I have created an account on postman and logged in - However from there I do not know what to do to find examples of the PHP cURL code (like what you sent me in the image in a previous reply). Do I need to upload that file 'amelia api all.postman.json' file into Postman? And if so where / how in Postman do I do that?
We just got the feedback from our colleagues and they have told us that you needs to import the collection we sent, in postman file -> import , when you import you can look at the category calls and there is this hook on the right side where you have code examples in different languages (this one with the </> sign):
Hope this helps.
Should you have any further inquiries, we kindly request that you open separate tickets for each question and we will gladly help you there.
Hi Marko, thank you again to you and your dev team for the helpful reply.
I have now been able to successfully import the postman collection you sent me and I can see all of the different API calls inside the application (matching the screenshots you sent me). This is great :) I will now work on developing my code further. As we are still talking about querying data from Amelia I did not think I would need to open a separate ticket here (plus I think this entire thread will be very helpful for other users of Amelia), but I will of course open up separate tickets if the subject was to change.
Thanks again for your help and have a great weekend,
Hi there,
Many of the projects that I work on which I could use Amelia for, I end up not using Amelia because your templates you have made do not fit the use case correctly and are not flexible enough to allow me to change them.
So what I would like to do is to code my own templates - but in order to do that I need to know how to query the data stored in Amelia.
Normally I would query custom post types, custom taxonomies, custom fields etc, but it seems that the data created by Amelia is not stored in the 'Wordpress way'. Unless I am mistaken?
Please can you help?
Thanks,
Keith
Hello Keith,
We have forwarded your ticket to our level 2 agents and as soon as we get some feedback from them we will contact you immediately.
Kind Regards,
Marko Davidovic [email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, floor plans, choropleth maps, and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Marko, thanks for your reply. I'm trying to understand more what you have sent me and also tried to query data via your API but nothing is working.
For example, I would like to query all of the 'Services' I have setup in Amelia, but I cannot see anywhere in your documentation where it explains how to do that.
I have used Chat GPT to try and help me code this and this is the snippet I am using:
<?php
$response = wp_remote_get('mysiteURL/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/services', [ 'headers' => [ 'Authorization' => 'Bearer MY_API_KEY' ]
]);
if (is_wp_error($response)) { // Handle error $error_message = $response->get_error_message(); echo "Something went wrong: $error_message";
} else { // Process the data $data = json_decode(wp_remote_retrieve_body($response), true); if (!empty($data)) { // If you want to see the full structure of the fetched data, uncomment the next line. // echo '<pre>' . print_r($data, true) . '</pre>';
// Display just the count of services for now. echo 'Number of services fetched: ' . count($data); } else { echo 'No services found.'; }
}
?>
I have of course here swapped my URL and my API key for dummy text.
This does not return any data, when I know that I have 15 services setup in Amelia.
Please can you provide instructions on how to query the services setup in Amelia? Or at the very least how to get all of the ID's for the services
Hello Keith,
We have forwarded your ticket to our level 2 agents again and as soon as we get some feedback from them we will contact you.
Kind Regards,
Marko Davidovic [email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, floor plans, choropleth maps, and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello Keith,
We just got the feedback from our colleagues and they have told us that the api key should be sent in the header property names "Amelia", not as an authorization token like in your example. Here is a php code snippet using cURL, to retrieve all the services (using localhost and a random apiKey: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0)
<?php
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=%2Fapi%2Fv1%2Fservices', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' ), ));
$response = curl_exec($curl);
curl_close($curl); echo $response;
?>
You can find example of code if you use Postman to open the postman collection we sent you and open the code segment on the right:
The API documentation of the other calls will be on the site soon.
Kind Regards,
Marko Davidovic [email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, floor plans, choropleth maps, and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Marko, thank you very much to you and your dev team for such a helpful and detailed reply :)
I am going to try this and see if I can get it to work. I will report back.
Thanks again,
Keith
Hi Marko, so from the code snippet you have sent me I have now been able to make a code snippet which queries services and displays the service name, description and price which is great. However, I have also tried to display the category of each service but this does not seem to work (and I know that all of my services have been applied to various categories).
So, I am guessing that I will need to look more at the 'amelia api all.postman.json' file you sent me. However, I have not used the 'Postman' system before and I was wondering if you can offer some guidance:
- I have created an account on postman and logged in
- However from there I do not know what to do to find examples of the PHP cURL code (like what you sent me in the image in a previous reply). Do I need to upload that file 'amelia api all.postman.json' file into Postman? And if so where / how in Postman do I do that?
Thanks again so much for your help
Hello Keith,
We have forwarded your ticket to our level 2 agents again and as soon as we get some feedback from them we will contact you.
Kind Regards,
Marko Davidovic [email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, floor plans, choropleth maps, and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello Keith,
We just got the feedback from our colleagues and they have told us that you needs to import the collection we sent, in postman file -> import , when you import you can look at the category calls and there is this hook on the right side where you have code examples in different languages (this one with the </> sign):
Hope this helps.
Should you have any further inquiries, we kindly request that you open separate tickets for each question and we will gladly help you there.
We wish you all the best.
Have a nice day.
Kind Regards,
Marko Davidovic [email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, floor plans, choropleth maps, and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Marko, thank you again to you and your dev team for the helpful reply.
I have now been able to successfully import the postman collection you sent me and I can see all of the different API calls inside the application (matching the screenshots you sent me). This is great :)
I will now work on developing my code further.
As we are still talking about querying data from Amelia I did not think I would need to open a separate ticket here (plus I think this entire thread will be very helpful for other users of Amelia), but I will of course open up separate tickets if the subject was to change.
Thanks again for your help and have a great weekend,
Keith
Hello Keith,
You are most welcome and we are glad to hear that our developers were able to help you.
Have a great week.
Kind Regards,
Marko Davidovic [email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, floor plans, choropleth maps, and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables