GetTripOptions পদ্ধতি

এই পদ্ধতিতে একটি নির্দিষ্ট ভ্রমণের জন্য উচ্চ-স্তরের টিকিটিং গ্রুপ প্রদান করা হয়। এর মধ্যে নির্বাচিত পরিষেবা শ্রেণীর কিছু অংশ থাকে যা একই টিকিটে বুক করা যায়, সেইসাথে সমগ্র টিকিটের ভাড়া এবং প্রাপ্যতার তথ্যও থাকে। মনে রাখবেন:

GetTripOptionsRequest সম্পর্কে

প্রোটো সংজ্ঞা

// Request sent to partners.
message GetTripOptionsRequest {
  // All segments together should form a single trip for which a ticket can be
  // booked.
  repeated ext.travel.transport.partner.SegmentKey segment_keys = 1;
}

JSON নমুনা

{
  "segment_keys": [
    {
      "ticketing_trip_id": "123456",
      "from_ticketing_stop_time_id": "ZRH-1234",
      "to_ticketing_stop_time_id": "LUZ-1235",
      "service_date": {
        "year": 2022,
        "month": 4,
        "day": 6
      },
      "boarding_time": {
        "year": 2022,
        "month": 4,
        "day": 6,
        "hours": 14,
        "minutes": 25,
        "seconds": 0,
        "nanos": 0,
        "utc_offset": "0s"
      },
      "arrival_time": {
        "year": 2022,
        "month": 4,
        "day": 6,
        "hours": 16,
        "minutes": 25,
        "seconds": 0,
        "nanos": 0,
        "utc_offset": "0s"
      }
    },
    {
      "ticketing_trip_id": "234567",
      "from_ticketing_stop_time_id": "LUZ-2759",
      "to_ticketing_stop_time_id": "WOL-2455",
      "service_date": {
        "year": 2022,
        "month": 4,
        "day": 6
      },
      "boarding_time": {
        "year": 2022,
        "month": 4,
        "day": 6,
        "hours": 18,
        "minutes": 13,
        "seconds": 0,
        "nanos": 0,
        "utc_offset": "0s"
      },
      "arrival_time": {
        "year": 2022,
        "month": 4,
        "day": 6,
        "hours": 20,
        "minutes": 13,
        "seconds": 0,
        "nanos": 0,
        "utc_offset": "0s"
      }
    }
  ]
}

GetTripOptionsপ্রতিক্রিয়া

প্রোটো সংজ্ঞা

// Response received from partners.
message GetTripOptionsResponse {
  oneof response {
    TripOptionsResult trip_options_result = 1;
    TripOptionsError trip_options_error = 2;
  }
}

// A successful partner response.
message TripOptionsResult {
  // Note:
  // - A TripOption represents the fare for a combination of available service
  //   classes for the segments in the request.
  // - If the seats within a service class are sold at different fares of
  //   limited availability, a different TripOption instance with the same
  //   sequence of segments can be returned for each fare.

  // Partners should also include options that are unavailable because they are
  // fully booked, using the appropriate Unavailable message below.
  repeated TripOption trip_options = 1;
}


// A travel option for users covering the whole end-to-end journey with the
// partner.
message TripOption {
  // A series of Segments that cover the whole trip option, one for each
  // SegmentKey in the request.
  repeated Segment segments = 1;

  // This is the lowest standard fare of all seats with the specified segments.
  // This field is optional if the series of segments is unavailable.
  // This "standard fare" should be the lowest seat price where no age or other
  // booking restrictions apply. The currency should be the local currency of
  // the origin of the first segment.
  Fare lowest_standard_fare = 2;

  // The availability status for bookings of this trip option at the
  // lowest_standard_fare.
  Availability availability = 3;

  // This is used to receive optional extra data via the Travel Transport API
  // and pass it into the ticketing deep link.
  // Booking links should still work without the booking token, but the token
  // can be used to ensure price consistency between Google Search results and
  // the partner booking page.
  string booking_token = 4 [features.field_presence = EXPLICIT];
}

// A segment traveled on a single vehicle in a given Service Class.
message Segment {
  SegmentKey segment_key = 1;

  // The service class used on this segment.
  ServiceClass service_class = 2;
}

JSON নমুনা

{
  "trip_options_result": {
    "trip_options": [
      {
        "segments": [
          {
            "segment_key": {
              "ticketing_trip_id": "123456",
              "from_ticketing_stop_time_id": "ZRH-1234",
              "to_ticketing_stop_time_id": "LUZ-1235",
              "service_date": {
                "year": 2022,
                "month": 4,
                "day": 6
              },
              "boarding_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 14,
                "minutes": 25,
                "seconds": 0,
                "utc_offset": "0s"
              },
              "arrival_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 16,
                "minutes": 25,
                "seconds": 0,
                "utc_offset": "0s"
              }
            },
            "service_class": {
              "type": "FIRST_CLASS"
            }
          },
          {
            "segment_key": {
              "ticketing_trip_id": "234567",
              "from_ticketing_stop_time_id": "LUZ-2759",
              "to_ticketing_stop_time_id": "WOL-2455",
              "service_date": {
                "year": 2022,
                "month": 4,
                "day": 6
              },
              "boarding_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 18,
                "minutes": 13,
                "seconds": 0,
                "utc_offset": "0s"
              },
              "arrival_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 20,
                "minutes": 13,
                "seconds": 0,
                "utc_offset": "0s"
              }
            },
            "service_class": {
              "type": "FIRST_CLASS"
            }
          }
        ],
        "lowest_standard_fare": {
          "total_amount": {
            "units": 15,
            "nanos": 0,
            "currency_code": "CHF"
          },
          "line_items": [
            {
              "line_item_type": "BASE_FARE",
              "amount": {
                "units": 13,
                "nanos": 950000000,
                "currency_code": "CHF"
              }
            },
            {
              "line_item_type": "SERVICE_CHARGE",
              "amount": {
                "units": 1,
                "nanos": 50000000,
                "currency_code": "CHF"
              }
            }
          ]
        },
        "availability": {
          "available": {
            "available_seat_count": 10,
            "total_seat_count": 30
          }
        }
      },
      {
        "segments": [
          {
            "segment_key": {
              "ticketing_trip_id": "123456",
              "from_ticketing_stop_time_id": "ZRH-1234",
              "to_ticketing_stop_time_id": "LUZ-1235",
              "service_date": {
                "year": 2022,
                "month": 4,
                "day": 6
              },
              "boarding_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 14,
                "minutes": 25,
                "seconds": 0,
                "utc_offset": "0s"
              },
              "arrival_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 16,
                "minutes": 25,
                "seconds": 0,
                "utc_offset": "0s"
              }
            },
            "service_class": {
              "type": "SECOND_CLASS"
            }
          },
          {
            "segment_key": {
              "ticketing_trip_id": "234567",
              "from_ticketing_stop_time_id": "LUZ-2759",
              "to_ticketing_stop_time_id": "WOL-2455",
              "service_date": {
                "year": 2022,
                "month": 4,
                "day": 6
              },
              "boarding_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 18,
                "minutes": 13,
                "seconds": 0,
                "utc_offset": "0s"
              },
              "arrival_time": {
                "year": 2022,
                "month": 4,
                "day": 6,
                "hours": 20,
                "minutes": 13,
                "seconds": 0,
                "utc_offset": "0s"
              }
            },
            "service_class": {
              "type": "SECOND_CLASS"
            }
          }
        ],
        "lowest_standard_fare": {
          "total_amount": {
            "units": 10,
            "nanos": 0,
            "currency_code": "CHF"
          },
          "line_items": [
            {
              "line_item_type": "BASE_FARE",
              "amount": {
                "units": 9,
                "nanos": 750000000,
                "currency_code": "CHF"
              }
            },
            {
              "line_item_type": "SERVICE_CHARGE",
              "amount": {
                "units": 0,
                "nanos": 250000000,
                "currency_code": "CHF"
              }
            }
          ]
        },
        "availability": {
          "available": {
            "available_seat_count": 44,
            "total_seat_count": 200
          }
        }
      }
    ]
  }
}

JSON ত্রুটির নমুনা

{
  "trip_options_error": {
    "error_type": "SEGMENT_KEY_NOT_FOUND",
    "error_message": "No matching segments found, no departures at 14:25"
  }
}

API বাস্তবায়ন দ্রষ্টব্য:

সম্ভাব্য পরিবর্তনগুলির সাথে ফরোয়ার্ড-সামঞ্জস্যতার জন্য, যদি সেগমেন্ট কীগুলিতে অতিরিক্ত প্যারামিটার দেখা দেয়, তবে সর্বদা প্রতিক্রিয়াতে সেগুলি ফিরিয়ে দিন। অন্যথায় প্যারামিটারগুলি উপেক্ষা করুন এবং অনুরোধটিকে এমনভাবে বিবেচনা করুন যেন সেগুলি সেখানে ছিল না, যতক্ষণ না আপনি প্যারামিটারগুলির জন্য নির্দিষ্ট সমর্থন বাস্তবায়ন করেন।

দাম এবং প্রাপ্যতা

উত্তরগুলিতে প্রাপ্যতা এবং দাম অবশ্যই সামঞ্জস্যপূর্ণ হতে হবে। ভ্রমণপথ উপলব্ধ থাকলেই কেবল মূল্য জানান। অনুপলব্ধ ভ্রমণপথের জন্য মূল্য প্রদান করবেন না।

ত্রুটির প্রতিক্রিয়া

নিম্নলিখিত টেবিলটি এই পদ্ধতির জন্য ত্রুটি প্রতিবেদনের প্রত্যাশা বর্ণনা করে:

ত্রুটির ধরণ পুনরায় চেষ্টা করা যাবে HTTP স্থিতি কোড বিবরণ
SEGMENT_KEY_NOT_FOUND না ৪০৪ প্রদত্ত SegmentKey গুলির একটির সাথে সম্পর্কিত সেগমেন্টটি খুঁজে পাওয়া যাচ্ছে না।
TRIP_OPTION_CACHE_STALE হাঁ ৪০৪ অনুরোধ করা ট্রিপ বিকল্পের ডেটা পার্টনারের কাছে আপ-টু-ডেট নেই এবং Google-এ সরবরাহ করার জন্য তা রিফ্রেশ করতে হবে।
INTERNAL_ERROR হাঁ ৫০০ এই ট্রিপটি পুনরুদ্ধার করার সময় একটি অপ্রত্যাশিত ত্রুটি ঘটেছে। এটি এমন একটি ত্রুটি নির্দেশ করে যা অংশীদারকে ঠিক করতে হবে।
SUBOPTIMAL_ITINERARY না ৪০৪ ট্রিপটি পাওয়া গেছে কিন্তু পার্টনার এটিকে অপ্রতুল মনে করে এবং এর টিকিট বিক্রি না করার সিদ্ধান্ত নেয়।
TICKETING_PROHIBITED না ৪০৪ ট্রিপটি পাওয়া গেছে কিন্তু অপারেটর বা রেল কর্তৃপক্ষ কর্তৃক আরোপিত সাধারণ টিকিট বিক্রয় বিধিনিষেধের কারণে অংশীদারকে এর টিকিট বিক্রি করার অনুমতি নেই।
BOOKING_WINDOW_NOT_SUPPORTED না ৪০৪ অনুরোধ করা তারিখের জন্য অংশীদার মূল্য নির্ধারণের ভ্রমণপথ সমর্থন করে না।

আরও বিস্তারিত জানার জন্য TripOptionsErrorType দেখুন

HTTP প্রতিক্রিয়াগুলিতে স্ট্যাটাস কোড রিটার্নের জন্য, স্ট্যাটাস কোড এবং ত্রুটি পরিচালনা দেখুন।