Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Use this online tool to generate code from sample JSON: Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {
-- "OTA_AirLowFareSearchRQ": {
-- "Version": "1",
-- "POS": {
-- "Source": [
-- {
-- "PseudoCityCode": "{{pcc}}",
-- "RequestorID": {
-- "Type": "1",
-- "ID": "1",
-- "CompanyName": {
-- "Code": "TN"
-- }
-- }
-- }
-- ]
-- },
-- "OriginDestinationInformation": [
-- {
-- "RPH": "1",
-- "DepartureDateTime": "{{start_date}}T00:00:00",
-- "OriginLocation": {
-- "LocationCode": "DEN"
-- },
-- "DestinationLocation": {
-- "LocationCode": "ABQ"
-- }
-- },
-- {
-- "RPH": "2",
-- "DepartureDateTime": "{{end_date}}T00:00:00",
-- "OriginLocation": {
-- "LocationCode": "ABQ"
-- },
-- "DestinationLocation": {
-- "LocationCode": "DEN"
-- }
-- }
-- ],
-- "TravelPreferences": {
-- "TPA_Extensions": {
-- "NumTrips": {
-- "Number": 10
-- },
-- "DataSources": {
-- "NDC": "Enable",
-- "ATPCO": "Disable",
-- "LCC": "Disable"
-- },
-- "PreferNDCSourceOnTie": {
-- "Value": true
-- }
-- }
-- },
-- "TravelerInfoSummary": {
-- "AirTravelerAvail": [
-- {
-- "PassengerTypeQuantity": [
-- {
-- "Code": "ADT",
-- "Quantity": 1
-- }
-- ]
-- }
-- ]
-- },
-- "TPA_Extensions": {
-- "IntelliSellTransaction": {
-- "RequestType": {
-- "Name": "200ITINS"
-- }
-- }
-- }
-- }
-- }
DECLARE @json int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.Version', '1'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.POS.Source[0].PseudoCityCode', '{{pcc}}'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.POS.Source[0].RequestorID.Type', '1'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.POS.Source[0].RequestorID.ID', '1'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.POS.Source[0].RequestorID.CompanyName.Code', 'TN'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[0].RPH', '1'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[0].DepartureDateTime', '{{start_date}}T00:00:00'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[0].OriginLocation.LocationCode', 'DEN'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[0].DestinationLocation.LocationCode', 'ABQ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[1].RPH', '2'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[1].DepartureDateTime', '{{end_date}}T00:00:00'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[1].OriginLocation.LocationCode', 'ABQ'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.OriginDestinationInformation[1].DestinationLocation.LocationCode', 'DEN'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'OTA_AirLowFareSearchRQ.TravelPreferences.TPA_Extensions.NumTrips.Number', 10
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.TravelPreferences.TPA_Extensions.DataSources.NDC', 'Enable'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.TravelPreferences.TPA_Extensions.DataSources.ATPCO', 'Disable'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.TravelPreferences.TPA_Extensions.DataSources.LCC', 'Disable'
EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'OTA_AirLowFareSearchRQ.TravelPreferences.TPA_Extensions.PreferNDCSourceOnTie.Value', 1
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.TravelerInfoSummary.AirTravelerAvail[0].PassengerTypeQuantity[0].Code', 'ADT'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'OTA_AirLowFareSearchRQ.TravelerInfoSummary.AirTravelerAvail[0].PassengerTypeQuantity[0].Quantity', 1
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'OTA_AirLowFareSearchRQ.TPA_Extensions.IntelliSellTransaction.RequestType.Name', '200ITINS'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Conversation-ID', '{{conv_id}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://domain.com/v2/offers/shop', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
END
GO
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "Conversation-ID: {{conv_id}}"
-d '{
"OTA_AirLowFareSearchRQ": {
"Version": "1",
"POS": {
"Source": [{
"PseudoCityCode": "{{pcc}}",
"RequestorID": {
"Type": "1",
"ID": "1",
"CompanyName": {
"Code": "TN"
}
}
}
]
},
"OriginDestinationInformation": [{
"RPH": "1",
"DepartureDateTime": "{{start_date}}T00:00:00",
"OriginLocation": {
"LocationCode": "DEN"
},
"DestinationLocation": {
"LocationCode": "ABQ"
}
}, {
"RPH": "2",
"DepartureDateTime": "{{end_date}}T00:00:00",
"OriginLocation": {
"LocationCode": "ABQ"
},
"DestinationLocation": {
"LocationCode": "DEN"
}
}
],
"TravelPreferences": {
"TPA_Extensions": {
"NumTrips": {
"Number": 10
},
"DataSources": {
"NDC": "Enable",
"ATPCO": "Disable",
"LCC": "Disable"
},
"PreferNDCSourceOnTie": {
"Value": true
}
}
},
"TravelerInfoSummary": {
"AirTravelerAvail": [{
"PassengerTypeQuantity": [{
"Code": "ADT",
"Quantity": 1
}
]
}
]
},
"TPA_Extensions": {
"IntelliSellTransaction": {
"RequestType": {
"Name": "200ITINS"
}
}
}
}
}'
https://domain.com/v2/offers/shop
Postman Collection Item JSON
{
"name": "1. Bargain Finder Max /v2",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Conversation-ID",
"value": "{{conv_id}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"OTA_AirLowFareSearchRQ\": {\n\t\t\"Version\": \"1\",\n\t\t\"POS\": {\n\t\t\t\"Source\": [{\n\t\t\t\t\t\"PseudoCityCode\": \"{{pcc}}\",\n\t\t\t\t\t\"RequestorID\": {\n\t\t\t\t\t\t\"Type\": \"1\",\n\t\t\t\t\t\t\"ID\": \"1\",\n\t\t\t\t\t\t\"CompanyName\": {\n\t\t\t\t\t\t\t\"Code\": \"TN\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t\"OriginDestinationInformation\": [{\n\t\t\t\t\"RPH\": \"1\",\n\t\t\t\t\"DepartureDateTime\": \"{{start_date}}T00:00:00\",\n\t\t\t\t\"OriginLocation\": {\n\t\t\t\t\t\"LocationCode\": \"DEN\"\n\t\t\t\t},\n\t\t\t\t\"DestinationLocation\": {\n\t\t\t\t\t\"LocationCode\": \"ABQ\"\n\t\t\t\t}\n\t\t\t}, {\n\t\t\t\t\"RPH\": \"2\",\n\t\t\t\t\"DepartureDateTime\": \"{{end_date}}T00:00:00\",\n\t\t\t\t\"OriginLocation\": {\n\t\t\t\t\t\"LocationCode\": \"ABQ\"\n\t\t\t\t},\n\t\t\t\t\"DestinationLocation\": {\n\t\t\t\t\t\"LocationCode\": \"DEN\"\n\t\t\t\t}\n\t\t\t}\n\t\t],\n\t\t\"TravelPreferences\": {\n\t\t\t\"TPA_Extensions\": {\n\t\t\t\t\"NumTrips\": {\n\t\t\t\t\t\"Number\": 10\n\t\t\t\t},\n\t\t\t\t\"DataSources\": {\n\t\t\t\t\t\"NDC\": \"Enable\",\n\t\t\t\t\t\"ATPCO\": \"Disable\",\n\t\t\t\t\t\"LCC\": \"Disable\"\n\t\t\t\t},\n \"PreferNDCSourceOnTie\": {\n \"Value\": true\n }\n\n\t\t\t}\n\t\t},\n\t\t\"TravelerInfoSummary\": {\n\t\t\t\"AirTravelerAvail\": [{\n\t\t\t\t\t\"PassengerTypeQuantity\": [{\n\t\t\t\t\t\t\t\"Code\": \"ADT\",\n\t\t\t\t\t\t\t\"Quantity\": 1\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t\"TPA_Extensions\": {\n\t\t\t\"IntelliSellTransaction\": {\n\t\t\t\t\"RequestType\": {\n\t\t\t\t\t\"Name\": \"200ITINS\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
},
"url": {
"raw": "{{rest_endpoint}}/v2/offers/shop",
"host": [
"{{rest_endpoint}}"
],
"path": [
"v2",
"offers",
"shop"
]
},
"description": "[//]: # \"Start\"\n\n<b>[Description](https://developer.sabre.com/docs/rest_apis/air/search/bargain_finder_max), [Resources](https://developer.sabre.com/docs/rest_apis/air/search/bargain_finder_max/resources)</b>\n\n[//]: # \"End\""
},
"response": [
]
}