当前位置: 首页 > 知识库问答 >
问题:

使用amadeus flight create orders API生成PNR问题

向苗宣
2023-03-14

我想使用amadeus航班预订API创建预订并生成PNR。我必须遵循3个步骤来创建预订并生成PNR

  1. Flight使用bellow API提供搜索API

https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-search/api-reference

https://developers.amadeus.com/self-service/category/air/api-doc/flight-offers-price/api-reference

https://developers.amadeus.com/self-service/category/air/api-doc/flight-create-orders/api-reference

当我用单向thip搜索城市时,选择具体的优惠并输入乘客详细信息以创建预订并生成PNR。然后PNR将成功生成我正在使用bellow API生成PNR

  https://developers.amadeus.com/self-service/category/air/api-doc/flight-create-orders/api-reference

这是我的请求json

  "data": {
    "type": "flight-order",
    "flightOffers": [
      {
        "type": "flight-offer",
        "id": "5",
        "source": "GDS",
        "instantTicketingRequired": false,
        "nonHomogeneous": false,
        "paymentCardRequired": false,
        "lastTicketingDate": "2021-07-23",
        "itineraries": [
          {
            "segments": [
              {
                "departure": {
                  "iataCode": "JFK",
                  "terminal": "5",
                  "at": "2021-07-30T09:20:00"
                },
                "arrival": {
                  "iataCode": "FLL",
                  "terminal": "3",
                  "at": "2021-07-30T12:30:00"
                },
                "carrierCode": "B6",
                "number": "201",
                "aircraft": {
                  "code": "320"
                },
                "operating": {
                  "carrierCode": "B6"
                },
                "duration": "PT3H10M",
                "id": "91",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 155,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              },
              {
                "departure": {
                  "iataCode": "FLL",
                  "terminal": "3",
                  "at": "2021-07-30T16:25:00"
                },
                "arrival": {
                  "iataCode": "LAX",
                  "terminal": "5",
                  "at": "2021-07-30T18:49:00"
                },
                "carrierCode": "B6",
                "number": "1301",
                "aircraft": {
                  "code": "32S"
                },
                "operating": {
                  "carrierCode": "B6"
                },
                "duration": "PT5H24M",
                "id": "92",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 253,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              }
            ],
            "duration": "PT12H29M"
          }
        ],
        "price": {
          "currency": "USD",
          "total": "276.20",
          "base": "235.35",
          "fees": [
            {
              "amount": "0.00",
              "type": "SUPPLIER"
            },
            {
              "amount": "0.00",
              "type": "TICKETING"
            },
            {
              "amount": "0.00",
              "type": "FORM_OF_PAYMENT"
            }
          ],
          "grandTotal": "276.20",
          "billingCurrency": "USD"
        },
        "pricingOptions": {
          "fareType": [
            "PUBLISHED"
          ],
          "includedCheckedBagsOnly": false
        },
        "validatingAirlineCodes": [
          "B6"
        ],
        "travelerPricings": [
          {
            "travelerId": "1",
            "fareOption": "STANDARD",
            "travelerType": "ADULT",
            "price": {
              "currency": "USD",
              "total": "276.20",
              "base": "235.35",
              "taxes": [
                {
                  "amount": "8.60",
                  "code": "ZP"
                },
                {
                  "amount": "5.60",
                  "code": "AY"
                },
                {
                  "amount": "17.65",
                  "code": "US"
                },
                {
                  "amount": "9.00",
                  "code": "XF"
                }
              ],
              "refundableTaxes": "40.85"
            },
            "fareDetailsBySegment": [
              {
                "segmentId": "91",
                "cabin": "ECONOMY",
                "fareBasis": "OL7AUEL1",
                "brandedFare": "DN",
                "class": "L",
                "includedCheckedBags": {
                  "quantity": 0
                }
              },
              {
                "segmentId": "92",
                "cabin": "ECONOMY",
                "fareBasis": "ZI3PUEL1",
                "brandedFare": "DN",
                "class": "L",
                "includedCheckedBags": {
                  "quantity": 0
                }
              }
            ]
          }
        ]
      }
    ],
    "travelers": [
      {
        "id": 1,
        "dateOfBirth": "**********",
        "name": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "gender": "**********"
      }
    ],
    "contacts": [
      {
        "addresseeName": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "purpose": "STANDARD",
        "emailAddress": "**********",
        "phones": [
          {
            "deviceType": "MOBILE",
            "countryCallingCode": "**",
            "number": "**********"
          }
        ],
        "address": {
          "lines": [
            "**********"
          ],
          "postalCode": "**********",
          "cityName": "**********",
          "countryCode": "**********"
        }
      }
    ],
    "remarks": {
      "general": [
        {
          "subType": "GENERAL_MISCELLANEOUS",
          "text": "ONLINE BOOKING FROM INCREIBLE VIAJES"
        }
      ]
    },
    "ticketingAgreement": {
      "option": "DELAY_TO_CANCEL",
      "delay": "6D"
    }
  }
}

这是我的API响应。成功生成PNR/

stdClass Object
(
    [warnings] => Array
        (
            [0] => stdClass Object
                (
                    [status] => 200
                    [code] => 0
                    [title] => ContactInfoSsrNotAddedToBookingWarning
                    [detail] => Unable to create some contact information SSR. Email and mobile phone number required.
                )

        )

    [data] => stdClass Object
        (
            [type] => flight-order
            [id] => eJzTd9f3cg228PcBAAskAls%3D
            [associatedRecords] => Array
                (
                    [0] => stdClass Object
                        (
                            [reference] => JES8OL
                            [creationDate] => 2021-07-23T10:28:00.000
                            [originSystemCode] => GDS
                            [flightOfferId] => 5
                        )

                )

            [flightOffers] => Array
                (
                    [0] => stdClass Object
                        (
                            [type] => flight-offer
                            [id] => 5
                            [source] => GDS
                            [nonHomogeneous] => 
                            [lastTicketingDate] => 2021-07-23
                            [itineraries] => Array
                        

但是当我用不同的城市搜索并遵循相同的步骤时。这是我的要求json

 data": {
    "type": "flight-order",
    "flightOffers": [
      {
        "type": "flight-offer",
        "id": "3",
        "source": "GDS",
        "instantTicketingRequired": false,
        "nonHomogeneous": false,
        "paymentCardRequired": false,
        "lastTicketingDate": "2021-07-28",
        "itineraries": [
          {
            "segments": [
              {
                "departure": {
                  "iataCode": "DEL",
                  "terminal": "3",
                  "at": "2021-08-05T05:35:00"
                },
                "arrival": {
                  "iataCode": "BLR",
                  "at": "2021-08-05T08:20:00"
                },
                "carrierCode": "AI",
                "number": "803",
                "aircraft": {
                  "code": "32B"
                },
                "operating": {
                  "carrierCode": "AI"
                },
                "duration": "PT2H45M",
                "id": "17",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 145,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              }
            ],
            "duration": "PT2H45M"
          },
          {
            "segments": [
              {
                "departure": {
                  "iataCode": "BLR",
                  "at": "2021-08-10T17:10:00"
                },
                "arrival": {
                  "iataCode": "DEL",
                  "terminal": "3",
                  "at": "2021-08-10T19:55:00"
                },
                "carrierCode": "AI",
                "number": "501",
                "aircraft": {
                  "code": "32B"
                },
                "operating": {
                  "carrierCode": "AI"
                },
                "duration": "PT2H45M",
                "id": "42",
                "numberOfStops": 0,
                "co2Emissions": [
                  {
                    "weight": 145,
                    "weightUnit": "KG",
                    "cabin": "ECONOMY"
                  }
                ]
              }
            ],
            "duration": "PT2H45M"
          }
        ],
        "price": {
          "currency": "USD",
          "total": "88.59",
          "base": "68.00",
          "fees": [
            {
              "amount": "0.00",
              "type": "SUPPLIER"
            },
            {
              "amount": "0.00",
              "type": "TICKETING"
            },
            {
              "amount": "0.00",
              "type": "FORM_OF_PAYMENT"
            }
          ],
          "grandTotal": "88.59",
          "billingCurrency": "USD"
        },
        "pricingOptions": {
          "fareType": [
            "PUBLISHED"
          ],
          "includedCheckedBagsOnly": true
        },
        "validatingAirlineCodes": [
          "AI"
        ],
        "travelerPricings": [
          {
            "travelerId": "1",
            "fareOption": "STANDARD",
            "travelerType": "ADULT",
            "price": {
              "currency": "USD",
              "total": "88.59",
              "base": "68.00",
              "taxes": [
                {
                  "amount": "6.34",
                  "code": "P2"
                },
                {
                  "amount": "3.78",
                  "code": "IN"
                },
                {
                  "amount": "3.63",
                  "code": "K3"
                },
                {
                  "amount": "2.28",
                  "code": "WO"
                },
                {
                  "amount": "4.56",
                  "code": "YR"
                }
              ],
              "refundableTaxes": "17.19"
            },
            "fareDetailsBySegment": [
              {
                "segmentId": "17",
                "cabin": "ECONOMY",
                "fareBasis": "SAP8",
                "class": "S",
                "includedCheckedBags": {
                  "weight": 25,
                  "weightUnit": "KG"
                }
              },
              {
                "segmentId": "42",
                "cabin": "ECONOMY",
                "fareBasis": "SAP8",
                "class": "S",
                "includedCheckedBags": {
                  "weight": 25,
                  "weightUnit": "KG"
                }
              }
            ]
          }
        ]
      }
    ],
    "travelers": [
      {
        "id": 1,
        "dateOfBirth": "**********",
        "name": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "gender": "**********"
      }
    ],
    "contacts": [
      {
        "addresseeName": {
          "firstName": "**********",
          "lastName": "**********"
        },
        "purpose": "STANDARD",
        "emailAddress": "**********",
        "phones": [
          {
            "deviceType": "**********",
            "countryCallingCode": "**",
            "number": "**********"
          }
        ],
        "address": {
          "lines": [
            "**********"
          ],
          "postalCode": "**********",
          "cityName": "**********",
          "countryCode": "**********"
        }
      }
    ],
    "remarks": {
      "general": [
        {
          "subType": "GENERAL_MISCELLANEOUS",
          "text": "ONLINE BOOKING FROM INCREIBLE VIAJES"
        }
      ]
    },
    "ticketingAgreement": {
      "option": "DELAY_TO_CANCEL",
      "delay": "6D"
    }
  }

这是我的API响应。

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [status] => 400
                    [code] => 34651
                    [title] => SEGMENT SELL FAILURE
                    [detail] => Could not sell segment 2
                    [source] => stdClass Object
                        (
                            [pointer] => /data/flightOffers[0]/itineraries[1]/segments[0]
                        )

                )

        )

)

你能告诉我有什么问题吗。我正在使用amadeus测试API凭据。还指导我如何解决问题谢谢

共有1个答案

洪育
2023-03-14

当尝试预订不再可用的座位时,您通常会遇到此错误。您正在使用测试环境,这意味着在测试中使用Amadeus for Developers的其他人都可以尝试预订相同的座位。

尝试其他航班,不要忘记在预订前执行航班优惠价格。

附言:我在上面的例子中看到一些个人数据,你应该编辑你的帖子来删除它。

 类似资料:
  • 需要一个用作所有函数的返回类型的类型。如果我需要生成一个AST,我应该使用什么返回类型?ANTLR3使用了 对象。 当输入节点时,我可以创建树的一个节点,但应该如何跟踪它的父节点? 关于如何将树重写规则转换为生成AST节点的方法,是否有任何示例?如果不是,是否可以为下面的规则提供一个示例? 下面是(3)的规则:

  • 我正在使用QueueAccessLLSRQ从Sabre中的特定队列中检索PNR。但是当我们访问队列时,它只返回999个PNR,而队列有5000多个PNR,我想这是Sabre的局限性。 如果有人能列出从队列中检索所有PNR的步骤,包括进程是否有从队列中删除PNR的步骤,我将非常感谢。 感谢您的时间

  • 无法使用Git bash生成密钥 给错误赋予错误转义字符“ygen” 运行密钥生成命令ssh-keygen-t rsa-C时“”

  • 这段代码第一次可以运行得很好,但是当我第二次运行app时,它不会立即生成PDF文件。

  • 我有以下代码,其中我尝试将范围的字符串表示转换为数字列表。例如,如果输入为“0-0,3-5,7-10”,则预期输出为“0,3,4,5,7,8,9,10”。但是,我在以下位置出错: 它说没有足够的值来解压。我的推理是,应该具有的形式,所以如果我将其拆分为,我应该得到两个值。有什么问题吗?

  • 我正在尝试实现DFS回溯算法,该算法涉及利用维基百科上的堆栈(而不是递归算法)。我试图生成一个由0和1组成的迷宫,其中1代表一堵墙,0代表一条可用路径。对于迷宫中不是墙的任何给定空间,必须始终有一条有效的路径,可以从任何其他非墙单元格到达。 我从一个迷宫开始,它是一个二维大小的迷宫阵列[15][20],然后按照算法将需要标记为已正确访问的单元格标记为已访问。最初,所有单元格(不包括外部边框)都标记