Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
' Use this online tool to generate code from sample JSON: Generate Code to Create JSON
' The following JSON is sent in the request body.
' {
' "criteria": {
' "hotelId": "{{HotelId}}",
' "arrivalDate": "2021-04-06",
' "nights": 1,
' "adults": 1,
' "children": 0,
' "numberOfRooms": 1,
' "roomType": "STDD",
' "rateCode": "RACK"
' }
' }
Dim json As New ChilkatJsonObject
success = json.UpdateString("criteria.hotelId","{{HotelId}}")
success = json.UpdateString("criteria.arrivalDate","2021-04-06")
success = json.UpdateInt("criteria.nights",1)
success = json.UpdateInt("criteria.adults",1)
success = json.UpdateInt("criteria.children",0)
success = json.UpdateInt("criteria.numberOfRooms",1)
success = json.UpdateString("criteria.roomType","STDD")
success = json.UpdateString("criteria.rateCode","RACK")
http.SetRequestHeader "x-app-key","{{AppKey}}"
http.SetRequestHeader "x-hotelid","{{HotelId}}"
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
Dim sbRequestBody As New ChilkatStringBuilder
success = json.EmitSb(sbRequestBody)
Dim resp As ChilkatHttpResponse
Set resp = http.PTextSb("PUT","https://domain.com/rsv/config/v0/hotels/{{HotelId}}/upsellRules/action/validate",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Debug.Print resp.StatusCode
Debug.Print resp.BodyStr
Curl Command
curl -X PUT
-H "Authorization: Bearer <access_token>"
-H "x-app-key: {{AppKey}}"
-H "x-hotelid: {{HotelId}}"
-d '{
"criteria": {
"hotelId": "{{HotelId}}",
"arrivalDate": "2021-04-06",
"nights": 1,
"adults": 1,
"children": 0,
"numberOfRooms": 1,
"roomType": "STDD",
"rateCode": "RACK"
}
}'
https://domain.com/rsv/config/v0/hotels/{{HotelId}}/upsellRules/action/validate
Postman Collection Item JSON
{
"name": "Test an upsell Rule",
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{Token}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [
{
"key": "x-app-key",
"type": "text",
"value": "{{AppKey}}"
},
{
"key": "x-hotelid",
"type": "text",
"value": "{{HotelId}}"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"criteria\": {\r\n \"hotelId\": \"{{HotelId}}\",\r\n \"arrivalDate\": \"2021-04-06\",\r\n \"nights\": 1,\r\n \"adults\": 1,\r\n \"children\": 0,\r\n \"numberOfRooms\": 1,\r\n \"roomType\": \"STDD\",\r\n \"rateCode\": \"RACK\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{HostName}}/rsv/config/v0/hotels/{{HotelId}}/upsellRules/action/validate",
"host": [
"{{HostName}}"
],
"path": [
"rsv",
"config",
"v0",
"hotels",
"{{HotelId}}",
"upsellRules",
"action",
"validate"
]
}
},
"response": [
]
}