Hotel API REST Functions

In this article

Requests and responses

Add comments to Reservation: CommentAdd()

Get available discounts: AvailableDiscountsForReservationGetList()

Update guest list: GuestUpdate()

Cancel a reservation: ReservationCancel()

Get reservation: ReservationGetByNo()

Get list of reservations: ReservationGetList()

Create reservation: ReservationSave()

Get reservations by Group No.: ReservationsGetByGroupNo()

Change reservation status : ReservationStatusUpdate()

Get list of rate codes: RateCodeGetList()

Create room type reserve: RoomTypeReserve()

Delete room type reserve: RoomTypeReserveDelete()

Get list of room type reserve: RoomTypeReserveGet()

Get list of room type reserve: RoomTypeReserveGet()

Make payment deposit: PaymentDeposit()

Make a payment refund: PaymentRefund()

Make a payment refund: PaymentRefund()

Get application version: Version()

All methods - overview

Hotel Web Services are published by default through the Hotel Initialization process under the name of HotelWSOData (Codeunit 10033507) in the Web Services page. It supports REST based data services.

After web services have been published, the URL structure looks like this:

ODataV4/WebServiceName_ProcedureName?Company=CompanyName

Example:

http://localhost:8080/LSHotelsMaster/ODataV4/HotelWSOData_RateGetList?Company=CRONUS%20-%20LS%20Central

After building the URL, you only need to change the name of the procedure or service.

Requests and responses

The Hotels API uses HTTP POST requests with JSON arguments and JSON responses.

Request authentication recommended is via OAuth. In On-Premises, authentication can also be done via NTLM or Basic Auth.

Responses are as follows:

{

"@odata.context": "BASEURL/$metadata#Edm.String",

"value" : "{

\"error\":0,

\"errorMessage\":\"\",

\"result\": ...

}"
}

The service response is in the "value" attribute. The response is JSON stringified and follows this structure:

error Integer. Indicates error types. 0 means success/ no-error.
errorMessage Indicates more details about an error.
result Contains returning information of service request. Commonly, returns a JSON object, but sometimes an array.

Multiple examples for all methods can be provided as a Postman project.

 

Add comments to Reservation: CommentAdd()

CommentAdd(comments: Text) :Text

This function uploads comments to reservation. The parameter comments is a JSON object stringified.

Request - comments object

  reservationNo Reservation no.
  comments Array of objects.
  comment
  commentCategory
Text. Comment text
Optional. Set a comment category, otherwise, it will get default category from Hotel Setup.

Get available discounts: AvailableDiscountsForReservationGetList()

AvailableDiscountsForReservationGetList(reservationNo: Code[20]) :Text

Update guest list: GuestUpdate()

GuestUpdate(guests: Text) :Text

This function uploads new guests to a reservation. The parameter guests is a JSON object stringified.

Request - comments object

  reservationNo Reservation no.
  guests Array of objects.
  address Text.
  address2 Text.
  city Text.
  country Country code
  email Text
  fullName Text. You can use full name as Guest name or leave it blank and specify name parts( first, middle and last).
  firstName Text
  middleName Text
  lastName Text
  namePrefix Text
  guestNo Code.
  isPrimaryGuest Boolean.
  phoneNo Text.
  mobilePhoneNo Text.
  postCode Text.
  sequence Integer
  stateProvince Text.

Cancel a reservation: ReservationCancel()

ReservationCancel(reservationNo: Code[20]; externalResNo: Code[40]) :Text

This function cancels a reservation based on Reservation No. or External Reservation No.

Return values

cancellationNo Reservation cancellation no.

Get reservation: ReservationGetByNo()

ReservationGetByNo(reservationNo: Code[20]; externalResNo: Code[40]) :Text

This function returns a JSON with reservation details searching by Reservation No. or External Reservation No.

Return values

reservation Top level. Reservation object with next attributes:
adults Integer.
arrivalDate Date.
balance Decimal. Current reservation balance
cancelationNo Code
checkinTime Time
checkoutTime Time
children Integer
country Country Code.
currency Code
customerName Text
customerNo Code
dateCreated Date. When reservation was created
dateLastModified Date. Last time when reservation was modified
departureDate Date
email Text
externalReservationNo Code
externalGroupNo Code
groupReservationNo Code
guestName Text
guestNo Code
iataNo Integer
internalStatus Enum
marketSegment Code
nights Integer
paymentStatus Enum
phoneNumber Text
promoCode Code
property Code
reservationChannel Code
reservationNo Code
rateCode Code
roomNumber Code
roomType Code
status Code
childrenAges Array of objects with next attributes:
  age Integer. Child age
  childgroup Code. Child group
  reservationNo Code. Reservation No.
comments Array of objects with next attributes:
  comment Text. Comment text
  date Date. When comment was created.
  commentCategory Code. Comment category
  lineNo Integer. Comment line no.
  no Text. Linked Record Id
  tableName Text. Linked Table
guests Array of objects with next attributes:
  email Text.
  fullName Text.
  groupReservationNo Code. Comment category
  guestGroupType Integer. Comment line no.
  guestNo Text. Linked Record Id
  guestType Text. Linked Table
  reservationNo Code.
  isPrimaryGuest Boolean.
  roomNo Code. Guest room No
  sequence Integer. Guest sequence
  memberContact Object with next attributes:
  accountNo (Only for primary guest) Code.
  address (Only for primary guest) Text.
  address2 (Only for primary guest) Text.
  city (Only for primary guest) Text.
  club (Only for primary guest) Code.
  country (Only for primary guest) Country code.
  email (Only for primary guest) Text.
  mobilePhoneNo (Only for primary guest) Text.
  name (Only for primary guest) Text.
  firstName (Only for primary guest) Text.
  middleName (Only for primary guest) Text.
  lastName (Only for primary guest) Text.
  mainContact (Only for primary guest) Code.
  phoneNo (Only for primary guest) Code.
  postCode (Only for primary guest) Code.
  schemeCode (Only for primary guest) Code.
payments Array of objects with next attributes:
  amount Decimal.
  authTransactionCode Text.
  authTransactionId Text.
  cardholderName Text.
  cardType Code.
  currency Code.
  description Text.
  groupReservationNo Code.
  invoiceType Enum.
  lineNo Integer.
  maskedCreditCardNo Code.
  paymentType Code.
  payReceiptNo Code.
  receiptNo Code.
  reservationNo Code.
  tokenNumber Text.
  transactionType Enum
  transactionDate Date.
revenueEntries Array of objects with next attributes:
  activityNo Code.
  activityStatus Code.
  amount Decimal.
  date Date.
  currency Code.
  currencyFactor Decimal. Exchange factor.
  dateCreated Date.
  dateLastModified Date.
  description Text.
  discountAmount Decimal.
  discountPct Decimal.
  lineNo Integer.
  groupReservationNo Code.
  includedInPackage Boolean.
  includedInRate Boolean.
  invoiceNo Integer.
  itemNo Code
  paid Boolean
  payingReservationNo Code
  priceIncludesVAT Boolean
  quantity Decimal
  receiptNo Code
  revenueCode Code
  revenueType Enum
  roomCharge Boolean.
  roomChargeReceiptNo Code.
  transactionType Enum
  unitOfMeasure Code.
  unitPrice Decimal.
  vatAmount Decimal.
  vatPct Decimal.
roomRates Array of objects with next attributes:
  availableRooms Text. Comment text
  totalRooms Date. When comment was created.
  derivedFrom Code. Comment category
  date Integer. Comment line no.
  dailyRateAttributeAmount Text. Linked Record Id
  enabled Boolean.
  extraAdult Decimal.
  housekeepingRule Code
  property Code
  rate Decimal
  rateCode Code.
  roomType Code.
  occupancyBasedPricing Boolean.
  rateAdult1 Decimal.
  rateAdult2 Decimal.
  childrenRateGroups Array of objects
    childGroup Code
    numberOfChildren Integer
    price Decimal

Get list of reservations: ReservationGetList()

ReservationGetList(property: Code[20]; arrDateFrom: Date; arrDateTo: Date; deptDateFrom: Date; deptDateTo: Date; guestNo: Code[20]; guestEmail: Text[255]) :Text

This function returns a JSON with a list of reservations filtered by date parameters, guest number, and guest email.

Return values

The returned value is an array of objects named "reservations". The objects have the same structure as in ReservationGetByNo.

Create reservation: ReservationSave()

ReservationSave(reservationSave: Text) : Text

This function creates a new reservation from a JSON input parameter with this structure:

adults Integer.
arrivalDate Date.
checkinTime Time.
checkoutTime Time.
currency Code.
departureDate Date.
externalReservationNo Code.
externalGroupNo Code.
iataNo Integer
marketSegment Text
property Code
reservationNo Code
rateCode Code
reservationChannel Code
roomType Code
childrenAges Array of objects with next attributes:
  age Integer.
comments Array of objects with next attributes:
  comment Text.
guests Array of objects with next attributes:
  address Text.
  address2 Text.
  city Text.
  country Country code
  email Text
  fullName Text. You can use full name as Guest name or leave it blank and specify name parts( first, middle and last).
  firstName Text
  middleName Text
  lastName Text
  namePrefix Text
  guestNo Code.
  isPrimaryGuest Boolean.
  phoneNo Text.
  mobilePhoneNo Text.
  postCode Text.
  sequence Integer
  stateProvince Text.
payment Object with next attributes:
  amount Decimal.
  authTransactionCode Code.
  authTransactionId Code.
  cardholderName Text.
  cardType Code.
  currency Code.
  currencyFactor Decimal.
  maskedCreditCardNumber Code.
  paymentType Code.
  reservationNo Code.
  tokenNumber Code.
  transactionType Code.
  transactionDate Date.
roomRates Array of objects with next attributes:
  amountAfterTax Decimal.
  currency Code.
  date Date.
  TaxAmount Decimal.

Return values

The returned value is a JSON object named "reservations". The object has the same structure as in ReservationGetByNo.

Get reservations by Group No.: ReservationsGetByGroupNo()

ReservationsGetByGroupNo(groupNo: Code[20]) : Text

This function returns a JSON with a list of reservations filtered by Group Number.

Return values

The returned value is an array of objects named "reservations". The objects have the same structure as in ReservationGetByNo.

Change reservation status : ReservationStatusUpdate()

ReservationStatusUpdate(reservationNo: Code[20], newStatus) :Text

Get list of rate codes: RateCodeGetList()

RateCodeGetList() : Text

This function returns a JSON with a list of rate codes.

Return values

rateCodes Array of objects with next attributes:
  cancellationPolicy Code.
  cancellationPolicyDescription Text.
  depositPolicy Code.
  depositPolicyDescription Text.
  description Text.
  housekeepingRule Code.
  name Text.
  rateCode Code.
  webEnabled Boolean,

Create room type reserve: RoomTypeReserve()

RoomTypeReserve(roomTypeReserve: Text) : Text

This function creates a new room type reserves from a JSON input parameter with this structure:

roomTypeReserve Array of objects with next attributes:
  entryNo Decimal.
  externalNo Code.
  roomType Code.
  property Code.
  blockedFrom Date.
  blockedTo Date.
  quantity Decimal.
  comment Text.

Return values

roomTypeBlock Array of objects with next attributes:
  entryNo Integer.
  externalNo Code.
  roomType Code.
  property Code.
  blockedFrom Date.
  quantity Decimal.
  comment Text.
  releaseDateTime DateTime.

Delete room type reserve: RoomTypeReserveDelete()

RoomTypeReserveDelete(entryNo: Integer; externalNo: Code[20]) :Text

This function deletes room type reserve using Entry No. or External no. to search record.

Get list of room type reserve: RoomTypeReserveGet()

RoomTypeReserveGet(entryNo: Integer; externalNo: Code[20]) : Text

This function returns a JSON with a list of room type reserve filtered by entryNo or externalNo.

Return values

roomTypeBlock Array of objects with next attributes:
  entryNo Integer.
  externalNo Code.
  roomType Code.
  property Code.
  blockedFrom Date.
  quantity Decimal.
  comment Text.
  releaseDateTime DateTime.

Get list of all room types from property: RoomTypesGetList()

RoomTypesGetList(property: Code[20]) : Text

This function returns a JSON with a list of room types filtered by property parameter.

Return values

roomTypes Array of objects with next attributes:
  property Code.
  roomType Code.
  bedType Code.
  description Text.
  name Text.
  noOfCribs Integer.
  noOfExtrabeds Integer.
  noOfPersons Integer.
  noOfAdults Integer.
  noOfChildren Integer,

Make payment deposit: PaymentDeposit()

PaymentDeposit(payment: Text) : Text

This function makes a deposit from a JSON payment with this structure:

payment Array of objects with next attributes:
  amount Decimal.
  authTransactionCode Code.
  authTransactionId Code.
  cardholderName Text.
  cardType Code.
  currency Code.
  currencyFactor Decimal.
  maskedCreditCardNumber Code.
  paymentType Code.
  reservationNo Code.
  tokenNumber Code.
  transactionType Code.
  transactionDate Date.

Return values

receiptNo Code. Receipt No. of deposit

Make a payment refund: PaymentRefund()

PaymentRefund(payment: Text) : Text

This function makes a refund from a JSON payment with this structure:

payment Array of objects with next attributes:
  amount Decimal.
  authTransactionCode Code.
  authTransactionId Code.
  cardholderName Text.
  cardType Code.
  currency Code.
  currencyFactor Decimal.
  maskedCreditCardNumber Code.
  paymentType Code.
  receiptNo Code.
  reservationNo Code.
  tokenNumber Code.
  transactionType Code.
  transactionDate Date.

Return values

receiptNo Code. Receipt No. of refund

Get reservation payments: PaymentsGetByNo()

PaymentsGetByNo(reservationNo: Code[20]; groupNo: Code[20]; receiptNo: Code[20]) : Text

This function returns a list of reservation payments filtered by Group No. or Reservation No. or Receipt No.

Return values

payments Array of objects with next attributes:
  amount Decimal.
  authTransactionCode Text.
  authTransactionId Text.
  cardholderName Text.
  cardType Code.
  currency Code.
  description Text.
  groupReservationNo Code.
  invoiceType Enum.
  lineNo Integer.
  maskedCreditCardNo Code.
  paymentType Code.
  payReceiptNo Code.
  receiptNo Code.
  reservationNo Code.
  tokenNumber Text.
  transactionType Enum
  transactionDate Date.

Get application version: Version()

Version() : Text

This function returns the system and LS Central version.

Return values

VersionResp Current full BC and LS Central version.
LSVersionResp Current LS Central version

 

All methods - overview

http://localhost:9048/Hotels240/ODataV4/$metadata
<Action Name="HotelWSOData_AvailableDiscountsForReservationGetList">
    <Parameter Name="reservationNo" Type="Edm.String" />  
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_CommentAdd">
    <Parameter Name="comments" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_GuestUpdate">
     <Parameter Name="guests" Type="Edm.String" />
     <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_MultiUse">
    <Parameter Name="jsonRequest" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_PaymentDeposit">
    <Parameter Name="payment" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_PaymentRefund">
    <Parameter Name="payment" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_PaymentsGetByNo">
    <Parameter Name="reservationNo" Type="Edm.String" />
    <Parameter Name="groupNo" Type="Edm.String" />
    <Parameter Name="receiptNo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_Ping">
    <Parameter Name="echo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RateCodeGetList">
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RateGetList">
    <Parameter Name="property" Type="Edm.String" />
    <Parameter Name="arrivalDate" Type="Edm.Date" />
    <Parameter Name="departDate" Type="Edm.Date" />
    <Parameter Name="roomType" Type="Edm.String" />
    <Parameter Name="rateCode" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationCancel">
    <Parameter Name="reservationNo" Type="Edm.String" />
    <Parameter Name="externalResNo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationDiscountsGetList">
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationExtraDelete">
    <Parameter Name="reservationNo" Type="Edm.String" />
    <Parameter Name="lineNo" Type="Edm.Int32" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationExtraGet">
    <Parameter Name="reservationNo" Type="Edm.String" />
    <Parameter Name="lineNo" Type="Edm.Int32" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationExtraSave">
<Parameter Name="reservationExtra" Type="Edm.String" />
<ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationGetByNo">
    <Parameter Name="reservationNo" Type="Edm.String" />
    <Parameter Name="externalResNo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationGetList">
    <Parameter Name="property" Type="Edm.String" />
    <Parameter Name="arrDateFrom" Type="Edm.Date" />
    <Parameter Name="arrDateTo" Type="Edm.Date" />
    <Parameter Name="deptDateFrom" Type="Edm.Date" />
    <Parameter Name="deptDateTo" Type="Edm.Date" />
    <Parameter Name="guestNo" Type="Edm.String" />
    <Parameter Name="guestEmail" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationSave">
<Parameter Name="reservationSave" Type="Edm.String" />
<ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationStatusUpdate">
<Parameter Name="reservationNo" Type="Edm.String" />
<Parameter Name="newStatus" Type="Edm.String" />
<ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_ReservationsGetByGroupNo">
    <Parameter Name="groupNo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RestrictionGetList">
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomAvailabilityGetList">
    <Parameter Name="property" Type="Edm.String" />
    <Parameter Name="roomType" Type="Edm.String" />
    <Parameter Name="arrivalDate" Type="Edm.Date" />
    <Parameter Name="departDate" Type="Edm.Date" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomAvailabilityOnlyGetList">
    <Parameter Name="property" Type="Edm.String" />
    <Parameter Name="roomType" Type="Edm.String" />
    <Parameter Name="arrivalDate" Type="Edm.Date" />
    <Parameter Name="departDate" Type="Edm.Date" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomTypeReserveDelete">
    <Parameter Name="property" Type="Edm.String" />
    <Parameter Name="lineNo" Type="Edm.Int32" />
    <Parameter Name="externalNo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomTypeReserveGet">
    <Parameter Name="property" Type="Edm.String" />
    <Parameter Name="lineNo" Type="Edm.Int32" />
    <Parameter Name="externalNo" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomTypeReserve">
    <Parameter Name="roomTypeReserve" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomTypesGetList">
    <Parameter Name="property" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_RoomsGetList">
    <Parameter Name="property" Type="Edm.String" />
    <ReturnType Type="Edm.String" />
</Action>
<Action Name="HotelWSOData_Version">
    <ReturnType Type="Edm.String" />
</Action>