JSON Format
You can choose whether to receive JSON (Java Script Object Notation) or XML by using the HTTP Accept header.
Most developers prefer working with JSON (Accept = application/json). Our API generates JSON or XML output according to these rules:
<alice>bob</alice>
becomes
{ "alice": "bob" }
<alice><bob>charlie</bob><david>edgar</david></alice>
becomes
{ "alice": { "bob": "charlie", "david": "edgar" } }
<alice><bob>charlie</bob><bob>david</bob></alice>
becomes
{ "alice": { "bob": ["charlie", "david"] } }
<alice charlie="david">bob</alice>
becomes
{ "alice": { "@charlie": "david", "$": "bob" } }
Example JSON
Code snippet: Json
{
"CityResource": {
"Cities": {
"City": {
"CityCode": "NYC",
"CountryCode": "US",
"Position": {
"Coordinate": {
"Latitude": 40.689919,
"Longitude": -74.044937
}
},
"Names": {
"Name": [{
"@LanguageCode": "de",
"$": "New York"
}, {
"@LanguageCode": "ru",
"$": "Нью-Йорк"
}, {
"@LanguageCode": "ko",
"$": "뉴욕"
}, {
"@LanguageCode": "pt",
"$": "Nova Iorque"
}, {
"@LanguageCode": "jp",
"$": "ニューヨーク"
}, {
"@LanguageCode": "kr",
"$": "뉴욕 - 존에프케네디 국제공항"
}, {
"@LanguageCode": "en",
"$": "New York"
}, {
"@LanguageCode": "it",
"$": "New York"
}, {
"@LanguageCode": "fr",
"$": "New York"
}, {
"@LanguageCode": "es",
"$": "Nueva York"
}, {
"@LanguageCode": "ka",
"$": "紐約"
}, {
"@LanguageCode": "ja",
"$": "ニューヨーク"
}, {
"@LanguageCode": "pl",
"$": "Nowy Jork"
}, {
"@LanguageCode": "mi",
"$": "纽约"
}]
},
"Airports": {
"AirportCode": ["EWR", "JFK", "LGA"]
}
}
},
"Meta": {
"@Version": "1.0.0",
"Link": [{
"@Href": "https:\/\/api-test.lufthansa.com\/v1\/references\/cities\/NYC",
"@Rel": "self"
}, {
"@Href": "https:\/\/api-test.lufthansa.com\/v1\/references\/countries\/US",
"@Rel": "related"
}, {
"@Href": "https:\/\/api-test.lufthansa.com\/v1\/references\/airports\/{airportCode}",
"@Rel": "related"
}, {
"@Href": "http:\/\/travelguide.lufthansa.com\/de\/de\/new-york-city\/",
"@Rel": "alternate"
}, {
"@Href": "http:\/\/travelguide.lufthansa.com\/de\/en\/new-york-city\/",
"@Rel": "alternate"
}]
}
}
}
Corresponding XML
Code snippet: XML
<?xml version="1.0" encoding="UTF-8"?>
<CityResource>
<Cities>
<City>
<CityCode>NYC</CityCode>
<CountryCode>US</CountryCode>
<Position>
<Coordinate>
<Latitude>40.689919</Latitude>
<Longitude>-74.044937</Longitude>
</Coordinate>
</Position>
<Names>
<Name LanguageCode="de">New York</Name>
<Name LanguageCode="ru">Нью-Йорк</Name>
<Name LanguageCode="ko">뉴욕</Name>
<Name LanguageCode="pt">Nova Iorque</Name>
<Name LanguageCode="jp">ニューヨーク</Name>
<Name LanguageCode="kr">뉴욕 - 존에프케네디 국제공항</Name>
<Name LanguageCode="en">New York</Name>
<Name LanguageCode="it">New York</Name>
<Name LanguageCode="fr">New York</Name>
<Name LanguageCode="es">Nueva York</Name>
<Name LanguageCode="ka">紐約</Name>
<Name LanguageCode="ja">ニューヨーク</Name>
<Name LanguageCode="pl">Nowy Jork</Name>
<Name LanguageCode="mi">纽约</Name>
</Names>
<Airports>
<AirportCode>EWR</AirportCode>
<AirportCode>JFK</AirportCode>
<AirportCode>LGA</AirportCode>
</Airports>
</City>
</Cities>
<Meta Version="1.0.0">
<Link Href="https://api-test.lufthansa.com/v1/references/cities/NYC" Rel="self"/>
<Link Href="https://api-test.lufthansa.com/v1/references/countries/US" Rel="related"/>
<Link Href="https://api-test.lufthansa.com/v1/references/airports/{airportCode}" Rel="related"/>
<Link Href="http://travelguide.lufthansa.com/de/de/new-york-city/" Rel="alternate"/>
<Link Href="http://travelguide.lufthansa.com/de/en/new-york-city/" Rel="alternate"/>
</Meta>
</CityResource>
Docs Navigation
- Lufthansa Open API
- Getting Started
- Public API Method Details
- Flight Schedules
- Reference Data
- Offers
- Operations
- Flight Schedules
- Flight Status
- Flight Status by Route
- Flight Status at Arrival Airport
- Flight Status at Departure Airport
- Flight Status Response
- Customer Flight Information
- Customer Flight Information at Arrival Airport
- Customer Flight Information by Route
- Customer Flight Information at Departure Airport
- Customer Flight Information Response
- Notifications
- cargo
- Partner API Method Details
- FlightOps/Crew API Method Details