jeffrey-dustin

1.0.0 • Public • Published

Getting started

example image

Before beginning work it is necessary that:

  • Your organization is registered and activated
  • You have participated in a kick­off meeting
  • The opening questionnaire has been filled out
  • You have your login and password. (Using it you get a unique session token that must be used in every request to API as param jwt)

Contact us to be registered and get your credentials.

All responses are returned as JSON.

This document covers all the API calls and other methods that can be used to complete Razor-Cloud integration. It is important to note that all parameters are case sensitive in this document and should be used as documented.

Responses: When a request is successful, a response body will typically be sent back in the form of a JSON object. An exception to this is when a DELETE request is processed, which will result in a successful 200 status and an empty response body.

How to Build

The generated SDK relies on Node Package Manager (NPM) being available to resolve dependencies. If you don't already have NPM installed, please go ahead and follow instructions to install NPM from here. The SDK also requires Node to be installed. If Node isn't already installed, please install it from here

NPM is installed by default when Node is installed

To check if node and npm have been successfully installed, write the following commands in command prompt:

  • node --version
  • npm -version

Version Check

Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):

npm install

Resolve Dependencies

Resolve Dependencies

This will install all dependencies in the node_modules folder.

Once dependencies are resolved, you will need to move the folder JeffreyDustin in to your node_modules folder.

How to Use

The following section explains how to use the library in a new project.

1. Open Project Folder

Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

Click on File and select Open Folder.

Open Folder

Select the folder of your SDK and click on Select Folder to open it up in Sublime Text. The folder will become visible in the bar on the left.

Open Project

2. Creating a Test File

Now right click on the folder name and select the New File option to create a new test file. Save it as index.js Now import the generated NodeJS library using the following lines of code:

var lib = require('lib');

Save changes.

Create new file

Save new file

3. Running The Test File

To run the index.js file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file:

node index.js

Run file

How to Test

These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run. Tests can be run in a number of ways:

Method 1 (Run all tests)

  1. Navigate to the root directory of the SDK folder from command prompt.
  2. Type mocha --recursive to run all the tests.

Method 2 (Run all tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha * to run all the tests.

Method 3 (Run specific controller's tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha Channel Management APIController to run all the tests in that controller file.

To increase mocha's default timeout, you can change the TEST_TIMEOUT parameter's value in TestBootstrap.js.

Run Tests

Initialization

Authentication

In order to setup authentication in the API client, you need the following information.

Parameter Description
jwt Token which need to be passed in every request as GET parameter. You will get this token in authorization response. Token is valid 1 hour.

API client can be initialized as following:

const lib = require('lib');

// Configuration parameters and credentials
lib.Configuration.jwt = "jwt"; // Token which need to be passed in every request as GET parameter. You will get this token in authorization response. Token is valid 1 hour.

Class Reference

List of Controllers

Class: AuthorizationController

Get singleton instance

The singleton instance of the AuthorizationController class can be accessed from the API Client.

var controller = lib.AuthorizationController;

Method: login

Tags: Skips Authentication

In order to begin utilizing the platform APIs, your application must be authenticated and authorized to access domain resources. Follow the URL with your credentials and obtain an authorization token which is used in every request. You will have 2 types of tokens. One is on the PMS level, and this one should be used when you send requests related to PMS/PM data. For managing properties, you will need a token on PM level, with PM credentials. For every API call it will be noted which API credentials you should use.

function login(username, password, callback)

Parameters

Parameter Tags Description
username Required Your account email address (for PMS or PM)
password Required Your password

Example Usage

    var username = 'username';
    var password = 'password';

    controller.login(username, password, function(error, response, context) {

    
    });

Back to List of Controllers

Class: PropertyManagersController

Get singleton instance

The singleton instance of the PropertyManagersController class can be accessed from the API Client.

var controller = lib.PropertyManagersController;

Method: pMslist

This API call will return a list of property managers (PM) that have been created in the BookingPal platform that is associated with your PMS. In all requests in this API section, you need to use your PMS credentials.

function pMslist(callback)

Example Usage

    controller.pMslist(function(error, response, context) {

    
    });

Method: createnewPropertyManager

This API call will allow the PMS to pass all data to BookingPal that is required for registering a new PM (Property Manager). All fields are mandatory - PMS must pass this data in order for a PM account to be created. You need to use PMS credentials for this request.

function createnewPropertyManager(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreatenewUpdatePropertyManagerRequest({"key":"value"});

    controller.createnewPropertyManager(contentType, body, function(error, response, context) {

    
    });

Method: getPropertyManagerdetaildata

This function will return a property manager’s details that belong to the current user. You need to use your PMS API credentials.

Request Body parameters are the same as for creating PM.

Response is the same as in creating a Property Manager function. Here you do not need to pass all root level fields, but if some are used - all fields inside are mandatory:

  • in CompanyDetails Model you can pass any field, and none of them is mandatory
  • in Policies Model - you can pass any field, and none of them is mandatory
  • if you do use PaymentPolicy - all fields inside are mandatory
  • if you do use CancellationPolicy - all fields inside are mandatory
  • if you use Payment Model - all fields inside are mandatory
function getPropertyManagerdetaildata(contentType, id, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
id Required Property Manager ID

Example Usage

    var contentType = 'Content-Type';
    var id = 'id';

    controller.getPropertyManagerdetaildata(contentType, id, function(error, response, context) {

    
    });

Method: updatePropertyManagerdetails

This function will update a property manager’s details. In case of an update you do not need to pass all information, but if you have values in one section - all fields inside are mandatory.

function updatePropertyManagerdetails(contentType, body, id, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description
id Required Property Manager ID

Example Usage

    var contentType = 'Content-Type';
    var body = new CreatenewUpdatePropertyManagerRequest({"key":"value"});
    var id = 'id';

    controller.updatePropertyManagerdetails(contentType, body, id, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ProductController

Get singleton instance

The singleton instance of the ProductController class can be accessed from the API Client.

var controller = lib.ProductController;

Method: getproductlist

This API call will return a list of properties that belong to the current user. This means that a user has to be logged in with products created already. Every API call in this section should be with PM credentials.

function getproductlist(callback)

Example Usage

    controller.getproductlist(function(error, response, context) {

    
    });

Method: createproduct

This function allows a logged in user to create new product. You can only send one product in each request.

function createproduct(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreateUpdatePropertyRequest({"key":"value"});

    controller.createproduct(contentType, body, function(error, response, context) {

    
    });

Method: updateproduct

This function allows a logged in user to update product details.

Request parameters and request example will be the same as in the create product API. The only field that must be added is the product id.

You need to have all other parameters which were used in the create API call that you want to keep (AltID can’t be updated). Everything that you do not send as an update will be deleted (overwritten).

Response parameters and response examples are the same as in the create product API.

function updateproduct(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreateUpdatePropertyRequest({"key":"value"});

    controller.updateproduct(contentType, body, function(error, response, context) {

    
    });

Method: deletelistproduct

This function allows logged in user to delete list of products.

function deletelistproduct(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new PropertyListRequest({"key":"value"});

    controller.deletelistproduct(contentType, body, function(error, response, context) {

    
    });

Method: getproductbyID

This function allows logged in user to get a specific product.

function getproductbyID(productId, callback)

Parameters

Parameter Tags Description
productId Required Id of the property

Example Usage

    var productId = 'productId';

    controller.getproductbyID(productId, function(error, response, context) {

    
    });

Method: deleteproduct

This function allows the logged in user to delete product.

function deleteproduct(productId, callback)

Parameters

Parameter Tags Description
productId Required Property ID

Example Usage

    var productId = 'productId';

    controller.deleteproduct(productId, function(error, response, context) {

    
    });

Method: activationlistproduct

This function allows logged in user to activate a list of products in BookingPal. Products MUST be activated successfully before they can be distributed to any channel.

Note: When a product is successfully activated it will be queued for the internal BP validation function and you will receive async push messages when the validation is completed - like it is described in the Validation section.

function activationlistproduct(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new PropertyListRequest({"key":"value"});

    controller.activationlistproduct(contentType, body, function(error, response, context) {

    
    });

Method: deactivationlistproduct

This function allows the logged in user to deactivate a list of products. This function will also close the calendars on every channel the products have been listed on.

function deactivationlistproduct(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new PropertyListRequest({"key":"value"});

    controller.deactivationlistproduct(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ImagesController

Get singleton instance

The singleton instance of the ImagesController class can be accessed from the API Client.

var controller = lib.ImagesController;

Method: getimagelistbyproductID

This function allows logged in user to get image list for the existing product

function getimagelistbyproductID(productId, callback)

Parameters

Parameter Tags Description
productId Required ID of the property

Example Usage

    var productId = 'productId';

    controller.getimagelistbyproductID(productId, function(error, response, context) {

    
    });

Method: deleteallimagesperproperty

This function allows logged in user to delete images.

function deleteallimagesperproperty(contentType, productId, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
productId Required ID of property for which you want to delete all images

Example Usage

    var contentType = 'Content-Type';
    var productId = 'productId';

    controller.deleteallimagesperproperty(contentType, productId, function(error, response, context) {

    
    });

Method: createimages

This function allows the logged in user to upload images for the existing product. Every new image will be sorted to the end. The first image sent will be used as the “Main Image”. (Image re-ordering can also be done within the BookingPal platform manually by users)

function createimages(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreateimagesRequest({"key":"value"});

    controller.createimages(contentType, body, function(error, response, context) {

    
    });

Method: deletelistofimages

This function allows the logged in user to delete image(s) from the existing product.

function deletelistofimages(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new DeletelistofimagesRequest({"key":"value"});

    controller.deletelistofimages(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: RatesAndAvailabilityController

Get singleton instance

The singleton instance of the RatesAndAvailabilityController class can be accessed from the API Client.

var controller = lib.RatesAndAvailabilityController;

Method: getratesandavailabilityproductID

This function allows logged in users to get rates and availability for the specific product. Every API call in this section should be with PM credentials.

function getratesandavailabilityproductID(contentType, productId, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
productId Required ID of the property

Example Usage

    var contentType = 'Content-Type';
    var productId = 'productId';

    controller.getratesandavailabilityproductID(contentType, productId, function(error, response, context) {

    
    });

Method: createandupdateratesandavailability

Create and update calls are the same. When data is sent, if the data already exists in BookingPal - that data will be updated. Otherwise it will be created (inserted). If you want to update data for some period, you should just send data for these dates. All other data (for other dates) will remain untouched. This allows you to update only changed periods and we will not delete previously sent data for other periods.

In the case of a first data push, all data for one property should be sent in one request. When making updates or changes to existing data, then all changed data should be sent in one request.

Note: if property is set to use LOS rates (supportedLosRates) - only field leadTime, array availableCount and availability can be updated in this API call (for MLT property). For SGL property only leadTime and availability can be updated. This API call can not be used for OWN properties. Important: Maximum allowed end date in any data type is 3 years in future.

Every API call in this section should be with PM credentials.

function createandupdateratesandavailability(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreateandupdateratesandavailabilityRequest({"key":"value"});

    controller.createandupdateratesandavailability(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: LOSPricingController

Get singleton instance

The singleton instance of the LOSPricingController class can be accessed from the API Client.

var controller = lib.LOSPricingController;

Method: createandupdateLOSLengthofStayPricing

Introduction: You can use this function if you would like to send BookingPal different prices for various Length of Stays with the same starting date.

LOS Pricing will be a different method in sending rates to BookingPal and is defined as pricing sent for a specific “Stay ranges”, In the LOS method you are setting specific rates based on the Length of Stay. (This is a different way to push rates to BookingPal. )

For date periods of 1 to 30 days a specific rate need to enter check-in date and a rate for every possible reservation starting at that date (i.e. 1 day, 2 days, up to 30 days, 30 days is the maximum value allowed for this field) you will need to send BookingPal total rate value for that period.

Maximum LOS number of days is 30. All other LOS values after 30 will not be saved. If you do not support reservation for some specific number of dates - send value 0.00 for this LOS number of days. Keep in mind that all values not sent for any specific check-in date will be considered as 0, and reservation for this number of days will not be possible.

Field maxGuests allows you to set different rates per different number of guests. If you do not have different rate values per number of guests - you can send the value for maximum number of guests, and all others will have the same rate.

For MLT properties which supported LOS price for update number of count you can use it rates and availability API.

It is suggested to manage availability over “rates and availability” API call, and to close/open dates over this call.

Note: this API call can be used only if you set supportedLosRates = true on the product. Otherwise using this API for specific product is not possible.

function createandupdateLOSLengthofStayPricing(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreateandupdateLOSRequest({"key":"value"});

    controller.createandupdateLOSLengthofStayPricing(contentType, body, function(error, response, context) {

    
    });

Method: getlospriceslistbyproductId

This function allows the logged in user to get a LOS rate for property.

function getlospriceslistbyproductId(productId, callback)

Parameters

Parameter Tags Description
productId Required Property ID in BookingPal

Example Usage

    var productId = 'productId';

    controller.getlospriceslistbyproductId(productId, function(error, response, context) {

    
    });

Back to List of Controllers

Class: FeeAndTaxController

Get singleton instance

The singleton instance of the FeeAndTaxController class can be accessed from the API Client.

var controller = lib.FeeAndTaxController;

Method: getfeeandtaxlistbyproductId

This function allows the logged in user to get a fee list for the specific product.

function getfeeandtaxlistbyproductId(productId, callback)

Parameters

Parameter Tags Description
productId Required ID of the property

Example Usage

    var productId = 'productId';

    controller.getfeeandtaxlistbyproductId(productId, function(error, response, context) {

    
    });

Method: createfeeandtax

This function allows the logged in user to set fees (i.e. cleaning fee, damage waiver, extra bed, extra person etc.) and taxes for the specific product. Here, you always need to send all fees and taxes for one property. All fees or taxes which were in our system for that property and which are not in the new request will be deleted. Taxes in the BookingPal system will always have percent value.

If you want to delete all fees and/or taxes for one property (if you do not have fees and taxes in your system for one property) send an empty list of fees and.or taxes. In short when you use this request you need to always send us a full list of fees and taxes per property, since we will do a full update.

function createfeeandtax(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreatefeeandtaxRequest({"key":"value"});

    controller.createfeeandtax(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: FeeAndTaxMandatoryAtThePropertyLevelController

Get singleton instance

The singleton instance of the FeeAndTaxMandatoryAtThePropertyLevelController class can be accessed from the API Client.

var controller = lib.FeeAndTaxMandatoryAtThePropertyLevelController;

Method: getfeeandtaxmandatory

This function allows the logged in user to get info about current set for all PM properties are fees/taxes set to be mandatory or not.

function getfeeandtaxmandatory(callback)

Example Usage

    controller.getfeeandtaxmandatory(function(error, response, context) {

    
    });

Method: importorupdatefeeandtaxmandatory

This function allows the logged in user to import or update a fee and tax mandatory.

function importorupdatefeeandtaxmandatory(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new SetfeeandtaxvalidationsettingRequest({"key":"value"});

    controller.importorupdatefeeandtaxmandatory(contentType, body, function(error, response, context) {

    
    });

Method: removeValidationSettings

This function allows the logged in user to remove any setup on property level and to return on default (which is that fee/taxes are mandatory). This API call will accept a list of properties.

function removeValidationSettings(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new PropertyListRequest({"key":"value"});

    controller.removeValidationSettings(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: YieldsController

Get singleton instance

The singleton instance of the YieldsController class can be accessed from the API Client.

var controller = lib.YieldsController;

Method: getYMRlistbyproductID

This function allows the logged in user to get yield management rules list of the specific product.

function getYMRlistbyproductID(productId, callback)

Parameters

Parameter Tags Description
productId Required ID of the property

Example Usage

    var productId = 'productId';

    controller.getYMRlistbyproductID(productId, function(error, response, context) {

    
    });

Method: createYMR

This function allows the logged-in user to add yield management rules for the specific product. Yield management rules can affect the final price of the property depending on some special conditions (like the length of stay, early booking, etc.). These rules automate price manipulations, on an inquiry by inquiry basis. When set criteria are met, they help maximize revenue and occupancy.

How is the price calculated? The price for a night is calculated based on the basic price and the yield management rules.

  • If no YMR: {basic price per night} = price per night
  • If YMR is set it can Increase/decrease percent or increase/decrease amount: {basic price per night} + {yield amount} = {price per night} or {basic price per night} - {yield amount} = {price per night}

The below examples will use the scenario to walk you step by step and explain how the price is calculated based on different YMRs. Let’s say that the basic price per night for 2016 is 100 USD.

This function is used also for updating yield. So if you already create a specific yield for some date - and you send a new one - we will update the yield for this date. If you need to delete a specific yield type - you can send an empty list for that type.

Important: The maximum allowed end date is 3 years in the future.

function createYMR(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new CreateYieldRequest({"key":"value"});

    controller.createYMR(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ValidationController

Get singleton instance

The singleton instance of the ValidationController class can be accessed from the API Client.

var controller = lib.ValidationController;

Method: bookingPalValidationjobFullPM

This function will allow the PMC to call the BookingPal property validation job for all properties identified which belong to the current user. Authorization token should be on PM level. Also we will run validation only for properties which are activated. If you deactivate property - we will not validate this property.

After the request you will get a response indicating if messages were processed or not. If the request is good your request for the validator job will be put into a queue. Once the request is processed, BookingPal will send an async push message per property informing the user if a property is valid or not, and if it is not valid - with reasons why the validation failed. This message will be sent on the endpoint which was entered in section Push Notifications, field asyncPush.

Note: If the property is distributed already on some channel - this property will not be moved to an Incomplete state. Also if you have property on Incomplete state because of some reason, and you update this data which causes that property is on ‘Incomplete’ property will not be moved automatically to a valid state. Instead, you should run a Validation job manually for that property or wait for our automatic validation job which we are running once per day.

To make the property ready for Onboarding you should run validation first. if the property is valid - it will be ready for onboarding. Otherwise - the property will be in Incomplete state. Also, we will run validation only for properties that are activated. If you deactivate property - we will not validate this property.

function bookingPalValidationjobFullPM(callback)

Example Usage

    controller.bookingPalValidationjobFullPM(function(error, response, context) {

    
    });

Method: bookingPalValidationjobListofproperties

This function will allow the PMS to call the BookingPal property validation job for a list of properties from request. These properties must belong to the current user and authorization token should be on PM level. Also, we will run validation only for properties that are activated. If you deactivate property - we will not validate this property.

function bookingPalValidationjobListofproperties(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new ValidationforListofpropertiesRequest({"key":"value"});

    controller.bookingPalValidationjobListofproperties(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: TestingOfMessageAPICallsController

Get singleton instance

The singleton instance of the TestingOfMessageAPICallsController class can be accessed from the API Client.

var controller = lib.TestingOfMessageAPICallsController;

Method: getTestmessagethreads

This function allows the logged in user to get all message threads or message threads with an unresponded message from guest for the whole PM. You need to use PM credentials. There is also paging as optional values. If you do not pass this value, we will return the first page and 10 threads per page.

Since API calls for messages depend on channel connections and these values will exist in BookingPal only if guests on channel create some message, these calls can work only on production. So for testing purposes we’ve built an additional endpoint with the same API calls where you will be able to test these calls.

Note: To be able to test these calls, you need to have at least 1 property, since we will in response return you messages for 1 property from your PM.

function getTestmessagethreads(page, limit, threadType, callback)

Parameters

Parameter Tags Description
page Required TODO: Add a parameter description
limit Required TODO: Add a parameter description
threadType Required Request all threads or only threads with unanswered message {new,all}

Example Usage

    var page = 213;
    var limit = 213;
    var threadType = 'threadType';

    controller.getTestmessagethreads(page, limit, threadType, function(error, response, context) {

    
    });

Method: getTestmessagelistforspecificthread

Since API calls for messages depend on channel connections and these values will exist in BookingPal only if guests on channel create some message, these calls can work only on production. So for testing purposes, we’ve built an additional endpoint with the same API calls where you will be able to test these calls.

This function allows the logged-in user to get a list of all messages from passed thread Id. You need to use PM credentials

Note: To be able to test these calls, you need to have at least 1 property, since we will in response return you messages for 1 property from your PM.

function getTestmessagelistforspecificthread(threadId, callback)

Parameters

Parameter Tags Description
threadId Required ID of thread

Example Usage

    var threadId = 'threadId';

    controller.getTestmessagelistforspecificthread(threadId, function(error, response, context) {

    
    });

Method: postnewTestmessageforspecificthread

This function will allow PM to post new messages in already existing threads. Since this call is only for testing - we will not actually save these passed values.

Since API calls for messages depend on channel connections and these values will exist in BookingPal only if guests on channel create some message, these calls can work only on production. So for testing purposes, we’ve built an additional endpoint with the same API calls where you will be able to test these calls.

Note: To be able to test these calls, you need to have at least 1 property, since we will in response return to you messages for 1 property from your PM.

function postnewTestmessageforspecificthread(body, callback)

Parameters

Parameter Tags Description
body Required TODO: Add a parameter description

Example Usage

    var body = new PostnewmessageforspecificthreadRequest({"key":"value"});

    controller.postnewTestmessageforspecificthread(body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: MessagingController

Get singleton instance

The singleton instance of the MessagingController class can be accessed from the API Client.

var controller = lib.MessagingController;

Method: getmessagethreads

This function allows the logged in user to get all message threads or message threads with unresponded message from guest for whole PM. You need to use PM credentials. There is also paging as optional values. If you do not pass this value, we will return first page and 10 threads per page. And in heading you will get a link for the next page.

function getmessagethreads(page, limit, threadType, callback)

Parameters

Parameter Tags Description
page Required Number of current page
limit Required Limit of how many threads will be showed at one page
threadType Required Request all threads or only threads with unanswered message {new,all}

Example Usage

    var page = 213;
    var limit = 213;
    var threadType = 'threadType';

    controller.getmessagethreads(page, limit, threadType, function(error, response, context) {

    
    });

Method: getmessagelistforspecificthread

This function allows the logged in user to get a list of all messages from passed thread Id. You need to use PM credentials.

function getmessagelistforspecificthread(threadId, callback)

Parameters

Parameter Tags Description
threadId Required ID of the thread

Example Usage

    var threadId = 'threadId';

    controller.getmessagelistforspecificthread(threadId, function(error, response, context) {

    
    });

Method: postnewmessageforspecificthread

This function will allow PM to post new messages in already existing threads.

function postnewmessageforspecificthread(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new PostnewmessageforspecificthreadRequest({"key":"value"});

    controller.postnewmessageforspecificthread(contentType, body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: RequestToBookController

Get singleton instance

The singleton instance of the RequestToBookController class can be accessed from the API Client.

var controller = lib.RequestToBookController;

Method: requesttoBookAnswerfromPMS

This is an API call which you should use for accepting on avoiding requests to book.

function requesttoBookAnswerfromPMS(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new RequesttoBookAnswerfromPMSRequest({"key":"value"});

    controller.requesttoBookAnswerfromPMS(contentType, body, function(error, response, context) {

    
    });

Method: requesttoBookTest

Since you can not get the request to book on our test environment (since this first needs to be created on the channel) We provide the possibility for PMS to test this request with some random filled data in our system. So when you call this API function - we will send you push notification for the request to book for a provided property ID.

function requesttoBookTest(body, callback)

Parameters

Parameter Tags Description
body Required TODO: Add a parameter description

Example Usage

    var body = new RequesttoBookTestRequest({"key":"value"});

    controller.requesttoBookTest(body, function(error, response, context) {

    
    });

Method: requesttoBookRequest

Tags: Skips Authentication

This will be a request which we will send to PMS when we get a request to book from the channel. So when BookingPal gets a new request to book request - we will push this POST request to the link which you set in BookingPal for your PMS (in Push Notification section - "requestToBook").

Important note: In this doc to be able to test this - you need to set a full URL on the Configure button in the right section.

function requesttoBookRequest(body, callback)

Parameters

Parameter Tags Description
body Required TODO: Add a parameter description

Example Usage

    var body = new RequestToBookRequestModel({"key":"value"});

    controller.requesttoBookRequest(body, function(error, response, context) {

    
    });

Back to List of Controllers

Class: PushNotificationController

Get singleton instance

The singleton instance of the PushNotificationController class can be accessed from the API Client.

var controller = lib.PushNotificationController;

Method: pushNotificationLinks

Provide the links on which the requests about new reservation and cancel reservation will be sent. Links should be https.

These links should be set on PMS level, so please use your PMS credentials.

function pushNotificationLinks(contentType, body, callback)

Parameters

Parameter Tags Description
contentType Required TODO: Add a parameter description
body Required TODO: Add a parameter description

Example Usage

    var contentType = 'Content-Type';
    var body = new PushNotificationLinksRequest({"key":"value"});

    controller.pushNotificationLinks(contentType, body, function(error, response, context) {

    
    });

Method: getNotificationLinks

This will return all notification URLs which are set. It will work on PMS level, so use PMS credentials.

function getNotificationLinks(callback)

Example Usage

    controller.getNotificationLinks(function(error, response, context) {

    
    });

Back to List of Controllers

Class: ReservationNotificationsController

Get singleton instance

The singleton instance of the ReservationNotificationsController class can be accessed from the API Client.

var controller = lib.ReservationNotificationsController;

Method: getReservationbyProduct

This function allows logged-in users to get all reservations for the specific product.

function getReservationbyProduct(productId, callback)

Parameters

Parameter Tags Description
productId Required Product ID

Example Usage

    var productId = 'productId';

    controller.getReservationbyProduct(productId, function(error, response, context) {

    
    });

Method: getReservationbyPM

This API call will return a list of reservations that belong to the current user.

function getReservationbyPM(callback)

Example Usage

    controller.getReservationbyPM(function(error, response, context) {

    
    });

Back to List of Controllers

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.00latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.00

Package Sidebar

Install

npm i jeffrey-dustin

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

510 kB

Total Files

168

Last publish

Collaborators

  • mujjazi