Skip to content

Commit

Permalink
Merge pull request #246 from amadeus4dev/remove-trip-parser
Browse files Browse the repository at this point in the history
Remove Trip Parser guides
  • Loading branch information
minjikarin authored Oct 1, 2024
2 parents dd383d8 + f578e6a commit 3a14462
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 135 deletions.
20 changes: 0 additions & 20 deletions docs/examples/code-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -887,26 +887,6 @@ By Id
--8<-- "https://github.com/amadeus4dev/amadeus-code-examples/raw/master/city_search/v1/get/Java%20SDK/CitySearch.java"
```

### Trip Parser

=== "Python"

```python
--8<-- "https://github.com/amadeus4dev/amadeus-code-examples/raw/master/trip_parser/v3/post/Python%20SDK/trip_parser.py"
```

=== "Node"

``` javascript
--8<-- "https://github.com/amadeus4dev/amadeus-code-examples/raw/master/trip_parser/v3/post/Node%20SDK/trip_parser.js"
```

=== "Java"

```java
--8<-- "https://github.com/amadeus4dev/amadeus-code-examples/raw/master/trip_parser/v3/post/Java%20SDK/TripParser.java"
```

### Trip Purpose Prediction

=== "Python"
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ In this section, you'll discover a comprehensive collection of tutorials for eac
| ----------- | ----------- |
| [Destination Experiences](./destination-experiences.md) | <ul><li>[Points of Interest](https://developers.amadeus.com/self-service/category/destination-content/api-doc/points-of-interest/api-reference){:target="\_blank"}</li><li>[Tours and Activities](https://developers.amadeus.com/self-service/category/destination-content/api-doc/tours-and-activities/api-reference){:target="\_blank"}</li></ul> |
| [Flights](./flights.md) | <ul><li>[Flight Offers Search](https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-search){:target="\_blank"}</li><li>[Flight Offers Price](https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-price){:target="\_blank"}</li><li>[Flight Create Orders](https://developers.amadeus.com/self-service/category/air/api-doc/flight-create-orders){:target="\_blank"}</li><li>[Flight Order Management](https://developers.amadeus.com/self-service/category/air/api-doc/flight-order-management){:target="\_blank"}</li><li>[Seatmap Display](https://developers.amadeus.com/self-service/category/air/api-doc/seatmap-display){:target="\_blank"}</li><li>[Branded Fares Upsell](https://developers.amadeus.com/self-service/category/air/api-doc/branded-fares-upsell){:target="\_blank"}</li><li>[Flight Price Analysis](https://developers.amadeus.com/self-service/category/air/api-doc/flight-price-analysis){:target="\_blank"}</li><li>[Flight Choice Prediction](https://developers.amadeus.com/self-service/category/air/api-doc/flight-choice-prediction){:target="\_blank"}</li><li>[Flight Inspiration Search](https://developers.amadeus.com/self-service/category/air/api-doc/flight-inspiration-search){:target="\_blank"}</li><li>[Flight Cheapest Date Search](https://developers.amadeus.com/self-service/category/air/api-doc/flight-cheapest-date-search){:target="\_blank"}</li><li>[Flight Availabilities Search](https://developers.amadeus.com/self-service/category/air/api-doc/flight-availabilities-search){:target="\_blank"}</li><li>[Travel Recommendations](https://developers.amadeus.com/self-service/category/trip/api-doc/travel-recommendations){:target="\_blank"}</li><li>[On Demand Flight Status](https://developers.amadeus.com/self-service/category/air/api-doc/on-demand-flight-status){:target="\_blank"}</li><li>[Flight Delay Prediction](https://developers.amadeus.com/self-service/category/air/api-doc/flight-delay-prediction){:target="\_blank"}</li><li>[Airport & City Search](https://developers.amadeus.com/self-service/category/air/api-doc/airport-and-city-search){:target="\_blank"}</li><li>[Airport Nearest Relevant](https://developers.amadeus.com/self-service/category/air/api-doc/airport-nearest-relevant){:target="\_blank"}</li><li>[Airport Routes API](https://developers.amadeus.com/self-service/category/air/api-doc/airport-routes){:target="\_blank"}</li><li>[Airport On-Time Performance](https://developers.amadeus.com/self-service/category/air/api-doc/airport-on-time-performance){:target="\_blank"}</li><li>[Flight Check-in Links](https://developers.amadeus.com/self-service/category/air/api-doc/flight-check-in-links){:target="\_blank"}</li><li>[Airline Code Lookup](https://developers.amadeus.com/self-service/category/air/api-doc/airline-code-lookup){:target="\_blank"}</li> <li>[Airline Routes](https://developers.amadeus.com/self-service/category/air/api-doc/airline-routes){:target="\_blank"}</li></ul> |
| [Hotels](./hotels.md) | <ul><li>[Hotel List](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-list/api-reference){:target="\_blank"}</li><li>[Hotel Ratings](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-ratings/api-reference){:target="\_blank"}</li><li>[Hotel Search](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-search/api-reference){:target="\_blank"}</li><li>[Hotel Booking](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking/api-reference){:target="\_blank"}</li><li>[Hotel Name Autocomplete API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-name-autocomplete/api-reference){:target="\_blank"}</li></ul> |
| [Itinerary Management](./itinerary-managment.md) | <ul><li>[Trip Parser](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-parser/api-reference){:target="\_blank"}</li><li>[Trip Purpose Prediction](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-purpose-prediction/api-reference){:target="\_blank"}</li><li>[City Search](https://developers.amadeus.com/self-service/category/trip/api-doc/city-search){:target="\_blank"}</li></ul> |
| [Hotels](./hotels.md) | <ul><li>[Hotel List](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-list/api-reference){:target="\_blank"}</li><li>[Hotel Ratangs](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-ratings/api-reference){:target="\_blank"}</li><li>[Hotel Search](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-search/api-reference){:target="\_blank"}</li><li>[Hotel Booking](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking/api-reference){:target="\_blank"}</li><li>[Hotel Name Autocomplete API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-name-autocomplete/api-reference){:target="\_blank"}</li></ul> |
| [Itinerary Management](./itinerary-managment.md) | <ul><li>[Trip Purpose Prediction](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-purpose-prediction/api-reference){:target="\_blank"}</li><li>[City Search](https://developers.amadeus.com/self-service/category/trip/api-doc/city-search){:target="\_blank"}</li></ul> |
| [Market insights](./market-insight.md) | <ul><li>[Flight Most Traveled Destinations](https://developers.amadeus.com/self-service/category/air/api-doc/flight-most-traveled-destinations/api-reference){:target="\_blank"}</li><li>[Flight Most Booked Destinations](https://developers.amadeus.com/self-service/category/air/api-doc/flight-most-booked-destinations/api-reference){:target="\_blank"}</li><li>[Flight Busiest Traveling Period](https://developers.amadeus.com/self-service/category/air/api-doc/flight-busiest-traveling-period/api-reference){:target="\_blank"}</li><li>[Location Score](https://developers.amadeus.com/self-service/category/destination-content/api-doc/location-score/api-reference){:target="\_blank"}</li></ul> |
112 changes: 0 additions & 112 deletions docs/resources/itinerary-managment.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,120 +7,8 @@ In the **Itinerary Management** category, you can give travelers a simple and pe

| APIs | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [Trip Parser](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-parser/api-reference){:target="\_blank"} | Build a single itinerary with information from different booking confirmation emails. |
| [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. |
| [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. |

## Parse the email confirmation into JSON

The [Trip Parser API](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-parser/api-reference){:target="\_blank"} helps to extract information from different booking confirmation emails and compile it into a single structured `JSON` itinerary. This API can parse information from `flight`, `hotel`, `rail`, and `rental car` confirmation emails. It provides the result of your parsing immediately, thanks to our algorithm.


### Encode your booking confirmation in Base64

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.

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:

```py
import base64
with open("booking.pdf", "rb") as booking_file:
encoded_string = base64.b64encode(booking_file.read())
print(encoded_string)
```

### Get the parsing results

Next, add the encoded booking confirmation to the body of a `POST` request to the endpoint

```bash
POST https://test.api.amadeus.com/v3/travel/trip-parser
```

```json
{
"payload": "your Base64 code here",
"metadata": {
"documentType": "PDF",
"name": "BOOKING_DOCUMENT",
"encoding": "BASE_64"
}
}
```

- `documentType` : pdf, xml, json or jpg
- `encoding` : BASE_64 or BASE_64_URL

This will extract all the relevant data from the booking information into a structured JSON format, just like the example below.

```json
{
"data": {
"trip": {
"reference": "JUPDRM",
"stakeholders": [
{
"name": {
"firstName": "MIGUEL",
"lastName": "TORRES"
}
}
],
"products": [
{
"air": {
"departure": {
"localDateTime": "2021-06-16T08:36:00"
},
"arrival": {
"localDateTime": "2021-06-17T00:00:00"
},
"marketing": {
"flightDesignator": {
"carrierCode": "CM",
"flightNumber": "644"
}
}
}
},
{
"air": {
"departure": {
"localDateTime": "2021-06-16T11:21:00"
},
"arrival": {
"localDateTime": "2021-06-17T00:00:00"
},
"marketing": {
"flightDesignator": {
"carrierCode": "CM",
"flightNumber": "426"
}
}
}
},
{
"air": {
"departure": {
"localDateTime": "2021-06-20T18:56:00"
},
"arrival": {
"localDateTime": "2021-06-21T00:00:00"
},
"marketing": {
"flightDesignator": {
"carrierCode": "CM",
"flightNumber": "645"
}
}
}
}
]
}
}
}

```


## Predict the trip purpose from a flight
Expand Down
1 change: 0 additions & 1 deletion docs/test-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ The table below details the available test data for each Self-Service API:

| **API** | **Test data** |
| ----------- | ----------- |
| [Trip Parser](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-parser){:target="\_blank"} | No data restrictions in test. |
| [Trip Purpose Prediction](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-purpose-prediction){:target="\_blank"} | No data restrictions in test. |

### Market insights
Expand Down

0 comments on commit 3a14462

Please sign in to comment.