Okay
  Public Ticket #1899844
REST api
Closed

Comments

  •  1
    Kahti Demba started the conversation

    Hi, I was wondering wether Amelia has a rest api that I could access. I ask this as I would like to use wordpress headless with a react.js frontend. 


  • [deleted] replied

    Hi Kahti,

    Thank you for your interest in our plugin.

    Yes we have API Routes for the Amelia app, but most of them are protected depends on of the permissions that is set in WordPress Accounts. You can check those API Routs in our free version of Amelia. Amelia Lite is a free WordPress booking plugin that allows to set up a fully-featured automated WordPress booking system on your website. It is a handy tool for small businesses and individuals that depend on stable appointment-booking processes. You can download it from this link.

    When you download Lite version you can find all API Routs in this file ../wp-content/plugins/ameliabooking/src/Infrastructure/Routes/Routes.php

    At the moment we have some JavaScript hooks that triggers after confirm booking, before confirm booking etc.

    Best regards.

  •  1
    Kahti Demba replied

    Thank you for your speedy reply! 

    I just got round to doing the below. 

    However, do you have documentation explaining how to use your api? 

    I can't find the url that I can call the endpoint with? 

  • [deleted] replied

    Hi Kahti,

    We have API Routes for the Amelia app, but most of them are protected depends on of the permissions that is set in WordPress Accounts. Like I said, you can check those API Routs in our free version of Amelia. When you download Lite version you can find all API Routs in this file ../wp-content/plugins/ameliabooking/src/Infrastructure/Routes/Routes.php

    As for other documentation unfortunately we don't have it at the moment.

    Best regards.

  •  1
    Kahti Demba replied

    Yes I understand but I think you misunderstood my question. I found the routes but I cannot find the URL to call the routes with? 

    for example another booking plugins api has this as their url: http://app.salonbooking.it/wp-json/salon/api/v1

    And with that you can call the following routes similar to your plugins; /services, /appointments etc etc.

    Therefore, what is amelias url that I can call the endpoints with? Hopefully you understand my question now, thank you.

    I would love to use and purchase amelia as I love UI, hopefully I can become accustomed with the api to build apps for my clients. Please help.

  • [deleted] replied

    Hi Kahti,

    I apologize for the late reply, we are in the middle of release of the new version.

    The routes start with "/wp-admin/admin-ajax.php?action=wpamelia_api&call=/"
    e.g.

    For fetching entities: /wp-admin/admin-ajax.php?action=wpamelia_api&call=/entities&types[]=categories&types[]=locations&types[]=employees&types[]=customers&types[]=custom_fields
    For booking: /wp-admin/admin-ajax.php?action=wpamelia_api&call=/booking

    Best regards.

  •  1
    Kahti Demba replied

    Thank you so much! 

    I have now encountered the permission problem. I have sought help via forums but they suggest I refer to the plugin developers. 

    How do I give the plugin permission under Wordpress?

    Also what does the new version entail. 

  • [deleted] replied

    Hi Kahti,

    Can you please tell me which version of Amelia are you using?

    Best regards.

  •  1
    Kahti Demba replied

    Hi I am on version 1.0.2. 


    Thank you

  • [deleted] replied

    Hi Kahti

    what exactly do you want to do with API? Do you wish to create your own custom front-end pages (e.g. booking form)? If yes, then both API URLs are enough, and they don't require having some WP role (you don't need to be logged in):

    (For fetching entities) /wp-admin/admin-ajax.php?action=wpamelia_api&call=/entities&types[]=categories&types[]=employees
    (For booking) /wp-admin/admin-ajax.php?action=wpamelia_api&call=/booking

    If you wish to change permissions for WP Dashboard for certain roles, then you need to use some additional WP Roles Management plugin.

    Best regards.

  •  1
    Kahti Demba replied

    Yes exactly that!

    Thank you Isidora, I had no idea you had replied, never received an email this time around so was just waiting not realising you had replied two whole weeks ago!

    Gonna get going playing about with the api! Hopefully its exactly what I'm looking for then I can go ahead a purchase for my client.

  • [deleted] replied

    Hi Kahti,

    You are welcome. 

    I don't know why you haven't't receive an email, this is probably something on the Ticksy side, they had some small issues lately.

    I hope that you will succeed in making exactly what you need.

    Best regards.


  • lananas1 replied

    Hi, 

    I'm using the amelia plugin and have customised it to show my own booking form. After upgrading to a newer version, I can't make appointments anymore - the API Call I was making to make the booking was this:

    ?action=wpamelia_api&call=/appointments

    Since upgrading to version 6.2.1 however, my POST has stopped working as it looks like some further information might need to be included in the post? is it security related? does some extra appointment data need to be included in my POST? (I was previously on an old version 1.3.4.).

    Below is what i'm doing:

    $bookingURL = $admin_ajax . '?action=wpamelia_api&call=/appointments';

    $response   = wp_remote_post( $bookingURL, array(
    'method'  => 'POST',
    'timeout' => 100,

    'httpversion' => '1.1',

    'headers' => array(
    'Authorization' => 'Basic ' . base64_encode( USERNAME . ':' . PASSWORD ),
    ),
    'body'    => $bookingData,
    'cookies' => array(),
    ) );


    Would really appreciate your help. 

    Thanks, 


  •  1,819
    Miloš replied

    Hi, lananas1.

    We will need help from our 2nd Tier Team to advise you about this,

    because customizing Amelia in this way with custom API calls does not fall under what our support usually covers,

    but we will do our best to advise you as much as our support can cover.

    -
    Can you please update to the latest Amelia version 6.2.3?

    Then purge all cache from the site,

     let us know if that helps, if not - please open a new ticket and we will get help from our senior 2nd level Team.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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