Created
December 15, 2015 13:42
-
-
Save slavahatnuke/fa686c058fa83ccd807d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "http://connect.bookt.com/ws/?apikey=" + key + "&method=" + method + "&entity=" + entity; | |
var moment = require('moment'); | |
var request = require('request'); | |
request({url: url}, function (error, response, body) { | |
console.log('>> booking',body); | |
var date = new Date(); | |
var checkIn = moment(date).add(2, 'weeks'); | |
var checkOut = moment(checkIn).add(2, 'days'); | |
var data = { | |
PropertyID: 197688, | |
Renter: { | |
FirstName: 'TEST FIRSTNAME', | |
LastName: 'TEST LASTNAME', | |
PrimaryEmail: '[email protected]' | |
}, | |
CheckIn: checkIn.format('YYYY-MM-DD'), | |
CheckOut: checkOut.format('YYYY-MM-DD') | |
}; | |
console.log('>> payload', data); | |
var url = "http://connect.bookt.com/ws/?method=save&entity=booking&apikey=" + key; | |
request.post(url, { | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}, | |
form: { | |
data: JSON.stringify(data) | |
} | |
}, function (error, response, body) { | |
console.log('save >> ', body); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment