Skip to content

Commit f578e6a

Browse files
committed
update itinerary
1 parent 444e936 commit f578e6a

File tree

1 file changed

+0
-106
lines changed

1 file changed

+0
-106
lines changed

docs/resources/itinerary-managment.md

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -10,112 +10,6 @@ In the **Itinerary Management** category, you can give travelers a simple and pe
1010
| [Trip Purpose Prediction](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-purpose-prediction/api-reference){:target="\_blank"} | Analyze a flight itinerary and predict whether the trip is for business or leisure. |
1111
| [City Search](https://developers.amadeus.com/self-service/category/trip/api-doc/city-search){:target="\_blank"} | Finds cities that match a specific word or string of letters. |
1212

13-
### Encode your booking confirmation in Base64
14-
15-
The first step to parsing is to encode your booking confirmation file in `Base64` format. This will give you the base of your API request. You should not add formatting or any other elements to your booking confirmation as it will affect the parsing.
16-
17-
There are many tools and software that you can use for Base64 encoding. Some programming languages implement encoding and decoding functionalities in their standard library. In `python`, for example, it will look similar to this:
18-
19-
```py
20-
import base64
21-
with open("booking.pdf", "rb") as booking_file:
22-
encoded_string = base64.b64encode(booking_file.read())
23-
print(encoded_string)
24-
```
25-
26-
### Get the parsing results
27-
28-
Next, add the encoded booking confirmation to the body of a `POST` request to the endpoint
29-
30-
```bash
31-
POST https://test.api.amadeus.com/v3/travel/trip-parser
32-
```
33-
34-
```json
35-
{
36-
"payload": "your Base64 code here",
37-
"metadata": {
38-
"documentType": "PDF",
39-
"name": "BOOKING_DOCUMENT",
40-
"encoding": "BASE_64"
41-
}
42-
}
43-
```
44-
45-
- `documentType` : pdf, xml, json or jpg
46-
- `encoding` : BASE_64 or BASE_64_URL
47-
48-
This will extract all the relevant data from the booking information into a structured JSON format, just like the example below.
49-
50-
```json
51-
{
52-
"data": {
53-
"trip": {
54-
"reference": "JUPDRM",
55-
"stakeholders": [
56-
{
57-
"name": {
58-
"firstName": "MIGUEL",
59-
"lastName": "TORRES"
60-
}
61-
}
62-
],
63-
"products": [
64-
{
65-
"air": {
66-
"departure": {
67-
"localDateTime": "2021-06-16T08:36:00"
68-
},
69-
"arrival": {
70-
"localDateTime": "2021-06-17T00:00:00"
71-
},
72-
"marketing": {
73-
"flightDesignator": {
74-
"carrierCode": "CM",
75-
"flightNumber": "644"
76-
}
77-
}
78-
}
79-
},
80-
{
81-
"air": {
82-
"departure": {
83-
"localDateTime": "2021-06-16T11:21:00"
84-
},
85-
"arrival": {
86-
"localDateTime": "2021-06-17T00:00:00"
87-
},
88-
"marketing": {
89-
"flightDesignator": {
90-
"carrierCode": "CM",
91-
"flightNumber": "426"
92-
}
93-
}
94-
}
95-
},
96-
{
97-
"air": {
98-
"departure": {
99-
"localDateTime": "2021-06-20T18:56:00"
100-
},
101-
"arrival": {
102-
"localDateTime": "2021-06-21T00:00:00"
103-
},
104-
"marketing": {
105-
"flightDesignator": {
106-
"carrierCode": "CM",
107-
"flightNumber": "645"
108-
}
109-
}
110-
}
111-
}
112-
]
113-
}
114-
}
115-
}
116-
117-
```
118-
11913

12014
## Predict the trip purpose from a flight
12115

0 commit comments

Comments
 (0)