Api: display next dates with availability for a set or a specific item

Hello!

on our website, in addition to the embedded calendar and booking interface, we are displaying a list of future departures with availability like this:



I have found a way to do this, however it seems quite inefficient so I wonder if the API could be adapted to make this easier.

What I am doing at the moment is :

1. querying `item/cal` passing the categories I want and the date (from now to some months in the future)
2. what I get back is a list of all possible dates, then I filter out the "emtpy" ones, then I get the ones with some availability and do a request to `item` for each of those.
3. with this info I then populate my markup

I have cached this and I am clearing the cache with webhooks, however when not cached this takes quite a long time.

Is there another way that I am missing? 

Could the Api be adapted to contain this type of information? as in "give me next dates with availability for this list of items / category", instead of having to do a lot of requests?

thank you for your attention!

Mario.


Comments

  • BrettBrett Checkfront
    Hi @vermario,

    Thank you for your question!

    The item endpoint supports a show_upcoming=1 parameter, which you can use on the item/{item_id} query to display a list of upcoming available dates. By default, it will return the next 4 available dates from the specified start_date, within a given upcoming window. The resulting query would look something like item/{item_id}?start_date=20180801&show_upcoming=1

    I hope this helps, but let me know if you have any questions!

    Best Regards,
    Brett - Checkfront Support Team
  • Hello @Brett

    that might be a step in the right direction. Is the 4 departures limit hardcoded or is there a possibility to get more?

    (it's a bit of a pity that this is not documented here: http://api.checkfront.com/ref/item.html , is there another source of documentation somewhere else?)

    Thanks for your answer!

    MArio.
  • Hi Mario,

    Thank you for the reply.

    There is no option to get more upcoming dates with a single query. If you need more dates, then you could perform multiple queries, using the day after the last returned upcoming date as the start date for your next query. But then you are back to potentially making many requests to get the needed information.

    Some endpoints/parameters are not publicly documented. This could be related to the intended use of the parameter, potential problems it could cause, or how performance heavy it is. There is no other source of documentation for the API.

    Let me know if you have any more questions.

    All the best,
    Chase - Checkfront Support Team
  • hello @checkfront_chase ,

    thanks for your reply: I understand the reasoning, and thanks for your suggestion about the possible query method.

    About the documentation, if the team found the time to document the rest of the webhooks it would be greatly appreciated. (I know that documentation lagging behind is pretty common :-) ) 

    thanks again for the support,

    MArio.


  • Hi Mario,

    I didn't even realize some of the webhook pages were blank! I will definitely add this to our to-do list; it should not be very difficult to complete those.

    Thanks for letting me know.

    All the best,
    Chase - Checkfront Support Team
  • Hello, is there a possibility to have show_upcoming=1 function on droplet for wordpress? So the calendar move to the next available dates for the item automatically?


  • Hello LeonGT,

    Thanks for the question.

    There is no way to add this option to a single Droplet, but under Manage > Layout > Booking Page > Upcoming, you can set your booking page to automatically advance to the next available date. Note that you will need to disable both the 'show unavailable' and 'show sold-out' items in order to enable this option.

    But please let me know if this is not what you are looking for.

    All the best,
    Chase - Checkfront Support Team
Sign In or Register to comment.