Connecting to Lleego API
If you do not have your API credentials, please move on Contact to get credentials.
Â
Once you have your API credentials, you will have:
A test endpoint
An API Key
User & Password
Â
In order to connect to Lleego API you must connect to the endpoint using:
The API Key as an entry HTTP Header called ‘x-api-key’.
User and Password for Authorization Basic
Â
HTTP
POST /api/v2/transport/avail? HTTP/1.1
Host: test-api-tr.lleego.com
Content-Type: application/json
x-api-key: {{your_api_key}}
Authorization: Basic {{base64(your_user:your_password)}}
{
"query": {
"criterias": [
{
"travel": {
"paxes_distribution": {
"passengers_ages": [
30
]
},
"journeys": [
{
"origin": "MAD",
"destination": "PAR",
"date": "2021-12-05"
}
],
"direct": false,
"exclude_usa": false,
"refundable": false,
"low_cost": false,
"baggage": false,
"disney": false,
"include_ndc": true,
"include_train": true,
"only_train": false
},
"rule": {
"combined": true,
"duplicated": false,
"show_data": true,
"show_partial": false
}
}
]
}
}
Â
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "{{your_endpoint}}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST", // it depends on the transaction
CURLOPT_POSTFIELDS =>"{{your_request_json}}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"x-api-key: {{your_api_key}}",
"Authorization: Basic {{base64(your_user:your_password)}}"
),
));
$response = curl_exec($curl);
curl_close($curl);
Â
Once you have completed your development and certification, a live endpoint and credentials will be sent.
Our certification process is very simple: once you have your development ready, we'll send you some TestCases, compare your results with Lleego front app and if there are the same, you are ready to go live.
Â