Latest commit 5f34b22
Lux Express ticket search widget example ======================================== You will learn how to create a ticket widget in order to use it on your homepage. You don't have to have written contract with Lux Express in order to add ticket widget to your homepage. However if you do, you can add your "agent id" (aka user id) for every request and your agency gets benefits according to your contract. If your widget stops working correctly, please search for CHANGES file from this repo, we keep this example as up-to date as possible. By the way, Lux Express has also complete ticket selling API, so you can integrate ticket selling directly to your own selling system. However this is much bigger work than this simple widget. Please ask your contact person about the full stack API documentation. Direct url ========== You can manually create and test search url in order to verify your api understandings or use this link directly. For example: from Tallinn Coach Station to Vilnius Coach Station at 01-05-2016 you can use following URL: http://ticketcloud.luxexpress.eu/en/from/tallinn/to/vilnius/departure/01-05-2016 JSON response, add .json at the end of url and replace use ticketapi.luxexpress.eu instead: http://ticketapi.luxexpress.eu/en/from/tallinn/to/vilnius/departure/01-05-2016.json And more complex example with return date and promo code: http://ticketcloud.luxexpress.eu/en/from/tallinn/to/vilnius/departure/01-05-2016/return/01-05-2016?promo_code=Sale API description --------------- Required values: * from - string or integer, short name of city or Lux Express own city id (values from our live site or from example) * to - string or integer, short name of city or Lux Express own city id (values from our live site or from example) * departue_at - date string, such as '01-09-2013' (day, month, year) Optional values if you need extra tweaking: * return_at - date string, such as '01-09-2013' (day, month, year), If return_at value is present we do have return ticket. * ticket_quantity - integer, number of tickets, default 1. * promo_code - string, applies for particular ongoing promotions * lang - string, currently supported values: lv, pl, fi, lt, et, ru, en default is en. Alternatively, just prefix path with lang as our examples. * currency - integer, Lux Express id for currency (values from our live site or from example), default is EUR or picked by language, :et => EUR, :lv => LVL * trips - integer, number of trips. Number 1 means it's direct trip and there are no connections. Number 2 means there is two trips and one stop where client has to change bus. * agent - integer, Lux Express user id Please ask from your contact person or log in to your Lux Express account and you will see at user edit url, the last number is your agent id. Example: https://ticket.luxexpress.eu/user/edit/83829 Your agent id is: 83829 Form request ============ You can also create html form in order to increase usability. Please, take a look of our exaple or from our working live widget: EN: http://ticketcloud.luxexpress.eu/en/ticket/search_frame_main ET: http://ticketcloud.luxexpress.eu/et/ticket/search_frame_main LV: http://ticketcloud.luxexpress.eu/lv/ticket/search_frame_main LT: http://ticketcloud.luxexpress.eu/lt/ticket/search_frame_main FI: http://ticketcloud.luxexpress.eu/fi/ticket/search_frame_main RU: http://ticketcloud.luxexpress.eu/ru/ticket/search_frame_main PL: http://ticketcloud.luxexpress.eu/pl/ticket/search_frame_main By the way, try to use GET instead POST, this helps us to use better caching stradegy. Current list of bus stops ========================= Static list of bus stops will be out of sync one day, we don't promise to keep widget's bus stop list up to date. There are two ways to get current list: * Dedicated Bus Stop API: http://ticketcloud.luxexpress.eu/en/bus_stops.json * From html source: http://ticketcloud.luxexpress.eu Twice a year should is resonable to sync bus stop list. Contribute ========== Feel free to fork the widget, your pull request contributions are welcome!