Agentivity API

<back to all web services

GetHotelSegments

The following routes are available for this service:
GET/HotelSegments
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PagingMetadata:
    # @ApiMember(DataType="string", Description="Starting Record", Name="Offset", ParameterType="query")
    offset: Optional[str] = None
    """
    Starting Record
    """


    # @ApiMember(DataType="string", Description="Number of records to return (PageSize)", Name="Limit", ParameterType="query")
    limit: Optional[str] = None
    """
    Number of records to return (PageSize)
    """


    # @ApiMember(DataType="string", Description="Total Number of Records in a Full Reponse (if no paging)", Name="TotalRecords", ParameterType="query")
    total_records: int = 0
    """
    Total Number of Records in a Full Reponse (if no paging)
    """


    # @ApiMember(DataType="string", Description="Total Number of Records in this Reponse (on this page)", Name="ResponseRecords", ParameterType="query")
    response_records: int = 0
    """
    Total Number of Records in this Reponse (on this page)
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CompanyLevelRequestBase(PagingMetadata, IMemberUsername, IMemberOwningCompanyCode):
    owning_company_code: Optional[List[str]] = None
    """
    Comma Delimited List of Owning Company Codes
    """

    user_name: Optional[str] = None
    """
    UserName in form of an email address
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomFieldData:
    field_name: Optional[str] = None
    field_value: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomFieldsCollection(List[CustomFieldData]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HotelSegment(IBookingCustomFields):
    agentivity_ref: int = 0
    pnr_creation_date: Optional[datetime.datetime] = None
    hotel_segment_nbr: Optional[str] = None
    record_locator: Optional[str] = None
    owning_agency_location_i_d: Optional[str] = None
    account: Optional[str] = None
    owning_consultant_i_d: Optional[str] = None
    owning_consultant: Optional[str] = None
    status_code: Optional[str] = None
    segment_creation_date: Optional[datetime.datetime] = None
    arrival_date: Optional[datetime.datetime] = None
    departure_date: Optional[datetime.datetime] = None
    nbr_nights: int = 0
    vendor_code: Optional[str] = None
    property_name: Optional[str] = None
    property_nbr: Optional[str] = None
    property_address: Optional[str] = None
    property_phone_nbr: Optional[str] = None
    city_code: Optional[str] = None
    city_name: Optional[str] = None
    country_code: Optional[str] = None
    country_name: Optional[str] = None
    passenger: Optional[str] = None
    confirmation_nbr: Optional[str] = None
    rate_access_code: Optional[str] = None
    room_booking_code: Optional[str] = None
    currency_code: Optional[str] = None
    rate_amount: Optional[str] = None
    nbr_rooms: int = 0
    booked_in_name: Optional[str] = None
    service_information: Optional[str] = None
    total_air_segs: Optional[str] = None
    creating_agency_iata: Optional[str] = None
    is_commissionable: Optional[bool] = None
    commission: Optional[str] = None
    is_passive: bool = False
    custom_fields: Optional[CustomFieldsCollection] = None
    hotel_notepad: Optional[str] = None


TItemResponse = TypeVar('TItemResponse')
TItem = TypeVar('TItem')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Report(Generic[TItemResponse, TItem]):
    item: Optional[TItem] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HotelSegmentsResponseReport(Report[HotelSegmentsItemResponse, HotelSegment]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CacheMetadata:
    cached_at: datetime.datetime = datetime.datetime(1, 1, 1)
    cache_expires_at: datetime.datetime = datetime.datetime(1, 1, 1)
    is_from_cache: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ResponseMetadata:
    success: bool = False
    has_cache: bool = False
    has_paging: bool = False
    cache_metadata: Optional[CacheMetadata] = None
    paging_metadata: Optional[PagingMetadata] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AgentivityError:
    error_code: Optional[str] = None
    message: Optional[str] = None
    status_code: Optional[str] = None
    verbose_message: Optional[str] = None


TItem = TypeVar('TItem')
TReport = TypeVar('TReport')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ItemResponse(Generic[TItem, TReport]):
    response_metadata: Optional[ResponseMetadata] = None
    response_report: Optional[TReport] = None
    response_error: Optional[AgentivityError] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HotelSegmentsItemResponse(ItemResponse[HotelSegment, HotelSegmentsResponseReport]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetHotelSegments(CompanyLevelRequestBase):
    date_start: Optional[str] = None
    """
    Date in format YYYYMMDD
    """

    date_end: Optional[str] = None
    """
    Date in format YYYYMMDD
    """

    account: Optional[List[str]] = None
    """
    Comma Delimited List of Accounts
    """

    city_code: Optional[str] = None
    """
    3 letter city code
    """

    with_notepad: Optional[str] = None
    """
    Include Notepad Entry: 1=Yes
    """

    owning_agency_location_i_d: Optional[List[str]] = None
    """
    Comma Delimited List of PCCs
    """

    owning_agency_country_code: Optional[List[str]] = None
    """
    Comma Delimited List of CountryCodes
    """

    date_search_type: Optional[str] = None
    """
    Date search type option, a single character (A to search by Arrival dates, C to search by booking creation dates, S to search by segment creation dates).
    """

    is_g_d_s: Optional[str] = None
    """
    IsGDS=0 (bookings from Non-GDS eg Supplier Direct). IsGDS=1 (bookings from GDS).
    """

    is_passive: Optional[str] = None
    """
    IsPassive=0 (only include non-passive segments). IsPassive=1 (only include passive segments).
    """

    custom_field: Optional[List[str]] = None
    """
    Comma Delimited List of Custom Fields
    """

Python GetHotelSegments DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /HotelSegments HTTP/1.1 
Host: api.agentivity.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AgentivityResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="schemas.agentivity.com/types">
  <ResponseMetadata>
    <Success>false</Success>
    <HasCache>false</HasCache>
    <HasPaging>false</HasPaging>
    <CacheMetadata>
      <IsFromCache>false</IsFromCache>
      <CachedAt>0001-01-01T00:00:00</CachedAt>
      <CacheExpiresAt>0001-01-01T00:00:00</CacheExpiresAt>
    </CacheMetadata>
    <PagingMetadata>
      <Limit>String</Limit>
      <Offset>String</Offset>
      <ResponseRecords>0</ResponseRecords>
      <TotalRecords>0</TotalRecords>
    </PagingMetadata>
  </ResponseMetadata>
  <ResponseReport>
    <Item>
      <AgentivityRef>0</AgentivityRef>
      <PNRCreationDate>0001-01-01T00:00:00</PNRCreationDate>
      <HotelSegmentNbr>String</HotelSegmentNbr>
      <RecordLocator>String</RecordLocator>
      <OwningAgencyLocationID>String</OwningAgencyLocationID>
      <Account>String</Account>
      <OwningConsultantID>String</OwningConsultantID>
      <OwningConsultant>String</OwningConsultant>
      <StatusCode>String</StatusCode>
      <SegmentCreationDate>0001-01-01T00:00:00</SegmentCreationDate>
      <ArrivalDate>0001-01-01T00:00:00</ArrivalDate>
      <DepartureDate>0001-01-01T00:00:00</DepartureDate>
      <NbrNights>0</NbrNights>
      <VendorCode>String</VendorCode>
      <PropertyName>String</PropertyName>
      <PropertyPhoneNbr>String</PropertyPhoneNbr>
      <PropertyNbr>String</PropertyNbr>
      <PropertyAddress>String</PropertyAddress>
      <CityCode>String</CityCode>
      <CityName>String</CityName>
      <CountryCode>String</CountryCode>
      <CountryName>String</CountryName>
      <Passenger>String</Passenger>
      <ConfirmationNbr>String</ConfirmationNbr>
      <RateAccessCode>String</RateAccessCode>
      <RoomBookingCode>String</RoomBookingCode>
      <CurrencyCode>String</CurrencyCode>
      <RateAmount>String</RateAmount>
      <NbrRooms>0</NbrRooms>
      <BookedInName>String</BookedInName>
      <ServiceInformation>String</ServiceInformation>
      <TotalAirSegs>String</TotalAirSegs>
      <CreatingAgencyIata>String</CreatingAgencyIata>
      <IsCommissionable>false</IsCommissionable>
      <Commission>String</Commission>
      <IsPassive>false</IsPassive>
      <CustomFields>
        <CustomField>
          <FieldName>String</FieldName>
          <FieldValue>String</FieldValue>
        </CustomField>
      </CustomFields>
      <HotelNotepad>String</HotelNotepad>
    </Item>
  </ResponseReport>
  <ResponseError>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StatusCode>String</StatusCode>
    <VerboseMessage>String</VerboseMessage>
  </ResponseError>
</AgentivityResponse>