Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
var queryParams = new chilkat.JsonObject();
queryParams.UpdateString("blockName","Oracle Conference");
queryParams.UpdateString("hotelId","{{HotelId}}");
queryParams.UpdateString("blockCodeTemplate","AAAAAAMMYY");
queryParams.UpdateString("startDate","2021-08-20");
http.SetRequestHeader("x-app-key","{{AppKey}}");
http.SetRequestHeader("x-hotelid","{{HotelId}}");
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";
// resp: HttpResponse
var resp = http.QuickRequestParams("GET","https://domain.com/blk/v0/defaultBlockCode",queryParams);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
console.log(resp.StatusCode);
console.log(resp.BodyStr);
}
chilkatExample();
Curl Command
curl -G -d "blockName=Oracle%20Conference"
-d "hotelId=%7B%7BHotelId%7D%7D"
-d "blockCodeTemplate=AAAAAAMMYY"
-d "startDate=2021-08-20"
-H "Authorization: Bearer <access_token>"
-H "x-hotelid: {{HotelId}}"
-H "x-app-key: {{AppKey}}"
https://domain.com/blk/v0/defaultBlockCode
Postman Collection Item JSON
{
"name": "Get block default code to use in postBlock",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{Token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "x-hotelid",
"value": "{{HotelId}}"
},
{
"key": "x-app-key",
"value": "{{AppKey}}"
}
],
"url": {
"raw": "{{HostName}}/blk/v0/defaultBlockCode?blockName=Oracle Conference&hotelId={{HotelId}}&blockCodeTemplate=AAAAAAMMYY&startDate=2021-08-20",
"host": [
"{{HostName}}"
],
"path": [
"blk",
"v0",
"defaultBlockCode"
],
"query": [
{
"key": "blockName",
"value": "Oracle Conference",
"description": "Add your block Name here, free text"
},
{
"key": "hotelId",
"value": "{{HotelId}}"
},
{
"key": "blockCodeTemplate",
"value": "AAAAAAMMYY"
},
{
"key": "startDate",
"value": "2021-08-20"
}
]
}
},
"response": [
]
}