Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Swift 2) WIN Air Freight - Send New Pouch RequestSends a "POST /api/v1/Awb" to send a new pouch request.
func chilkatTest() { // This example assumes the Chilkat HTTP API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp() // Set the "Accept" header to tell the web server that we'll accept an XML response. http.Accept = "application/xml" // Tell Chilkat to cache any received cookies to files in a particular directory http.CookieDir = "c:/qa_data/cookies" http.SaveCookies = true // Also tell Chilkat to load and send matching cookies from the CookieDir. // The authToken cookie is first obtained in the login request. Each subsequent // request sends the authToken cookie and saves the new authToken cookie to the CookieDir. http.SendCookies = true // Build out XML pouch request... let xml = CkoXml() xml.Tag = "PouchDTO" xml.UpdateChildContent("Mawb|AwbID", value: "") xml.UpdateChildContent("Mawb|AwbNumber", value: "001-12312123") xml.UpdateChildContent("Mawb|AwbStatus", value: "D") xml.UpdateChildContent("Mawb|eAWB", value: "false") xml.UpdateChildContent("Mawb|WithPaper", value: "false") xml.UpdateChildContent("Mawb|Parties|Shipper|WinID", value: "444444") xml.UpdateChildContent("Mawb|Parties|Shipper|AccountNumber", value: "12345") xml.UpdateChildContent("Mawb|Parties|Shipper|Name", value: "AABC SHIPPING & PACKAGING, INC.") xml.UpdateChildContent("Mawb|Parties|Shipper|Phone", value: "111-222-3334") xml.UpdateChildContent("Mawb|Parties|Shipper|Fax", value: "222-111-3334") xml.UpdateChildContent("Mawb|Parties|Shipper|Email", value: "") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|Line1", value: "500 HARBOR DRIVE") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|Line2", value: "SUITE B1211") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|Place", value: "BEAUFORT") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|PostalCode", value: "28516") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|StateProvince", value: "NC") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|Country|Code", value: "US") xml.UpdateChildContent("Mawb|Parties|Shipper|Address|Country|Name", value: "U.S.A.") xml.UpdateChildContent("Mawb|Parties|Consignee|WinID", value: "0") xml.UpdateChildContent("Mawb|Parties|Consignee|AccountNumber", value: "") xml.UpdateChildContent("Mawb|Parties|Consignee|Name", value: "DELTA MANUFACTURING") xml.UpdateChildContent("Mawb|Parties|Consignee|Phone", value: "444-555-3333") xml.UpdateChildContent("Mawb|Parties|Consignee|Fax", value: "") xml.UpdateChildContent("Mawb|Parties|Consignee|Email", value: "") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|Line1", value: "185 RUE LAMANDE") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|Line2", value: "") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|Place", value: "PARIS") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|PostalCode", value: "75017") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|StateProvince", value: "") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|Country|Code", value: "FR") xml.UpdateChildContent("Mawb|Parties|Consignee|Address|Country|Name", value: "FRANCE") xml.UpdateChildContent("Mawb|Parties|Notify|WinID", value: "") xml.UpdateChildContent("Mawb|Parties|Notify|AccountNumber", value: "") xml.UpdateChildContent("Mawb|Parties|Notify|Name", value: "AABC SHIPPING, INC.") xml.UpdateChildContent("Mawb|Parties|Notify|Phone", value: "") xml.UpdateChildContent("Mawb|Parties|Notify|Fax", value: "") xml.UpdateChildContent("Mawb|Parties|Notify|Email", value: "") xml.UpdateChildContent("Mawb|Parties|Notify|Address|Line1", value: "110 FARA WAY") xml.UpdateChildContent("Mawb|Parties|Notify|Address|Line2", value: "") xml.UpdateChildContent("Mawb|Parties|Notify|Address|Place", value: "OZ") xml.UpdateChildContent("Mawb|Parties|Notify|Address|PostalCode", value: "11222") xml.UpdateChildContent("Mawb|Parties|Notify|Address|StateProvince", value: "NY") xml.UpdateChildContent("Mawb|Parties|Notify|Address|Country|Code", value: "US") xml.UpdateChildContent("Mawb|Parties|Notify|Address|Country|Name", value: "U.S.A.") xml.UpdateChildContent("Mawb|Parties|Agent|WinID", value: "") xml.UpdateChildContent("Mawb|Parties|Agent|AccountNumber", value: "FACCT#1234") xml.UpdateChildContent("Mawb|Accounting|Identifier", value: "GEN") xml.UpdateChildContent("Mawb|Accounting|Information", value: "SARFWER") xml.UpdateChildContent("Mawb|Accounting|Identifier", value: "MCO") xml.UpdateChildContent("Mawb|Accounting|Information", value: "WERWERWER") xml.UpdateChildContent("Mawb|ShipmentReference|ReferenceNumber", value: "ZDFASF") xml.UpdateChildContent("Mawb|ShipmentReference|AdditionalInformation", value: "ZDFASF") xml.UpdateChildContent("Mawb|RoutingDetails|FromAirportCode", value: "EWN") xml.UpdateChildContent("Mawb|RoutingDetails|ToAirportCode", value: "LON") xml.UpdateChildContent("Mawb|RoutingDetails|CarrierCode", value: "AA") xml.UpdateChildContent("Mawb|RoutingDetails|FlightNumber", value: "N123") xml.UpdateChildContent("Mawb|RoutingDetails|FlightDate", value: "2016-11-30T00:00:00") xml.UpdateChildContent("Mawb|ChargesDeclaration|CurrencyCode", value: "USD") xml.UpdateChildContent("Mawb|ChargesDeclaration|ChargeCode", value: "PP") xml.UpdateChildContent("Mawb|ChargesDeclaration|WeightOrValuation", value: "P") xml.UpdateChildContent("Mawb|ChargesDeclaration|Other", value: "P") xml.UpdateChildContent("Mawb|ChargesDeclaration|ValuesForCarriage", value: "1300.00") xml.UpdateChildContent("Mawb|ChargesDeclaration|ValuesForCustoms", value: "12000.00") xml.UpdateChildContent("Mawb|ChargesDeclaration|ValuesForInsurance", value: "11000.00") xml.UpdateChildContent("Mawb|Handling|SpecialServiceInformation", value: "Please Notify Consigneetestwwwww") xml.UpdateChildContent("Mawb|Handling|OtherServiceInformation", value: "") xml.UpdateChildContent("Mawb|Handling|SCI", value: "") xml.UpdateChildContent("Mawb|Handling|SpecialHandling|Code", value: "AOG") xml.UpdateChildContent("Mawb|Handling|SpecialHandling|Code", value: "ATT") xml.UpdateChildContent("Mawb|Rates|NumberOfPieces", value: "12") xml.UpdateChildContent("Mawb|Rates|GrossWeight|Value", value: "244.70") xml.UpdateChildContent("Mawb|Rates|GrossWeight|UOM", value: "L") xml.UpdateChildContent("Mawb|Rates|SLAC", value: "12") xml.UpdateChildContent("Mawb|Rates|RateClassCode", value: "N") xml.UpdateChildContent("Mawb|Rates|CommodityItemNumber", value: "") xml.UpdateChildContent("Mawb|Rates|ChargeableWeight", value: "245.0") xml.UpdateChildContent("Mawb|Rates|RateOrCharge", value: "8.00") xml.UpdateChildContent("Mawb|Rates|ChargeAmount", value: "1960.00") xml.UpdateChildContent("Mawb|Rates|NatureAndQuantityOfGoods", value: "CONSOLIDATION PER ATTACHED MANIFEST.") xml.UpdateChildContent("Mawb|Rates|Dims|Pcs", value: "12") xml.UpdateChildContent("Mawb|Rates|Dims|Length", value: "4") xml.UpdateChildContent("Mawb|Rates|Dims|Width", value: "8") xml.UpdateChildContent("Mawb|Rates|Dims|Height", value: "4") xml.UpdateChildContent("Mawb|Rates|Dims|UOM", value: "CMT") xml.UpdateChildContent("Mawb|ChargesSummary|WeightCharge", value: "1960.00") xml.UpdateChildContent("Mawb|OtherCharges|Description", value: "AW") xml.UpdateChildContent("Mawb|OtherCharges|Amount", value: "123.00") xml.UpdateChildContent("Mawb|OtherCharges|ChargeIdentifier", value: "C") xml.UpdateChildContent("Mawb|OtherCharges|PrepaidCollect", value: "C") xml.UpdateChildContent("Mawb|OtherCharges|Description", value: "FC") xml.UpdateChildContent("Mawb|OtherCharges|Amount", value: "55.00") xml.UpdateChildContent("Mawb|OtherCharges|ChargeIdentifier", value: "A") xml.UpdateChildContent("Mawb|OtherCharges|PrepaidCollect", value: "P") xml.UpdateChildContent("Mawb|OtherCharges|Description", value: "FC") xml.UpdateChildContent("Mawb|OtherCharges|Amount", value: "101.00") xml.UpdateChildContent("Mawb|OtherCharges|ChargeIdentifier", value: "C") xml.UpdateChildContent("Mawb|OtherCharges|PrepaidCollect", value: "C") xml.UpdateChildContent("Mawb|EmailNotifications|Name", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Email", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Name", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Email", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Name", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Email", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Name", value: "") xml.UpdateChildContent("Mawb|EmailNotifications|Email", value: "") xml.UpdateChildContent("Mawb|Execution|Date", value: "2015-08-07T00:00:00") xml.UpdateChildContent("Mawb|Execution|Place", value: "OZ NY") xml.UpdateChildContent("Mawb|Execution|ShipperSignature", value: "OAS FREIGHT FORWARDE") xml.UpdateChildContent("Mawb|Execution|CarrierSignature", value: "OAS FREIGHT FORWARDE") xml.UpdateChildContent("Hawbs|AwbNumber", value: "001-12312123") xml.UpdateChildContent("Hawbs|HawbNumber", value: "CGL201107-27") xml.UpdateChildContent("Hawbs|HawbStatus", value: "D") xml.UpdateChildContent("Hawbs|NumberOfPieces", value: "12") xml.UpdateChildContent("Hawbs|GrossWeight|Value", value: "244.70") xml.UpdateChildContent("Hawbs|GrossWeight|UOM", value: "K") xml.UpdateChildContent("Hawbs|Locations|PortOfOrigin|Code", value: "EWN") xml.UpdateChildContent("Hawbs|Locations|PortOfDestination|Code", value: "LON") xml.UpdateChildContent("Hawbs|Commodity", value: "HWB #: CGL20110") xml.UpdateChildContent("Hawbs|SLAC", value: "12") xml.UpdateChildContent("Hawbs|Parties|Shipper|Name", value: "ABC SHIPPNG AGAIN") xml.UpdateChildContent("Hawbs|Parties|Shipper|Phone", value: "111-222-3333") xml.UpdateChildContent("Hawbs|Parties|Shipper|Fax", value: "") xml.UpdateChildContent("Hawbs|Parties|Shipper|Email", value: "") xml.UpdateChildContent("Hawbs|Parties|Shipper|Address|Line1", value: "100 MAIN STREET") xml.UpdateChildContent("Hawbs|Parties|Shipper|Address|Place", value: "OZ") xml.UpdateChildContent("Hawbs|Parties|Shipper|Address|PostalCode", value: "ZIP") xml.UpdateChildContent("Hawbs|Parties|Shipper|Address|StateProvince", value: "NY") xml.UpdateChildContent("Hawbs|Parties|Shipper|Address|Country|Code", value: "US") xml.UpdateChildContent("Hawbs|Parties|Consignee|Name", value: "AABC SHIPPING & PACKAGING, INC.") xml.UpdateChildContent("Hawbs|Parties|Consignee|Phone", value: "111-222-3334") xml.UpdateChildContent("Hawbs|Parties|Consignee|Fax", value: "222-111-3334") xml.UpdateChildContent("Hawbs|Parties|Consignee|Email", value: "") xml.UpdateChildContent("Hawbs|Parties|Consignee|Address|Line1", value: "500 HARBOR DRIVE") xml.UpdateChildContent("Hawbs|Parties|Consignee|Address|Place", value: "BEAUFORT") xml.UpdateChildContent("Hawbs|Parties|Consignee|Address|PostalCode", value: "28516") xml.UpdateChildContent("Hawbs|Parties|Consignee|Address|StateProvince", value: "NC") xml.UpdateChildContent("Hawbs|Parties|Consignee|Address|Country|Code", value: "US") xml.EmitXmlDecl = false var resp: CkoHttpResponse? = http.PText("POST", url: "http://integration.winwebconnect.com/api/v1/Awb", textData: xml.GetXml(), charset: "utf-8", contentType: "application/xml", md5: false, gzip: false) if http.LastMethodSuccess != true { print("\(http.LastErrorText)") return } let xmlResponse = CkoXml() xmlResponse.LoadXml(resp!.BodyStr) // See below for an example XML response body. print("Response Body:") print("\(xmlResponse.GetXml())") print("---") print("Response Header:") print("\(resp!.Header)") resp = nil print("Success.") } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.