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
(SQL Server) Shippo Create Shipment ObjectCreate a Shipment object to retrieve rates. It represents a request to ship a given package from the sender to the recipient address. For more information, see https://goshippo.com/docs/shipping-labels/
-- 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 -- Implements the following CURL command: -- curl https://api.goshippo.com/shipments/ \ -- -H "Authorization: ShippoToken <API_TOKEN>" \ -- -H "Content-Type: application/json" \ -- -d '{ -- "address_from":{ -- "name":"Mr. Hippo", -- "street1":"215 Clayton St.", -- "city":"San Francisco", -- "state":"CA", -- "zip":"94117", -- "country":"US" -- }, -- "address_to":{ -- "name":"Mrs. Hippo", -- "street1":"965 Mission St.", -- "city":"San Francisco", -- "state":"CA", -- "zip":"94105", -- "country":"US" -- }, -- "parcels":[{ -- "length":"5", -- "width":"5", -- "height":"5", -- "distance_unit":"in", -- "weight":"2", -- "mass_unit":"lb" -- }], -- "async": false -- }' -- Use this online tool to generate code from sample JSON: -- Generate Code to Create JSON -- The following JSON is sent in the request body. -- { -- "address_from": { -- "name": "Mr. Hippo", -- "street1": "215 Clayton St.", -- "city": "San Francisco", -- "state": "CA", -- "zip": "94117", -- "country": "US" -- }, -- "address_to": { -- "name": "Mrs. Hippo", -- "street1": "965 Mission St.", -- "city": "San Francisco", -- "state": "CA", -- "zip": "94105", -- "country": "US" -- }, -- "parcels": [ -- { -- "length": "5", -- "width": "5", -- "height": "5", -- "distance_unit": "in", -- "weight": "2", -- "mass_unit": "lb" -- } -- ], -- "async": false -- } 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, 'address_from.name', 'Mr. Hippo' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_from.street1', '215 Clayton St.' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_from.city', 'San Francisco' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_from.state', 'CA' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_from.zip', '94117' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_from.country', 'US' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_to.name', 'Mrs. Hippo' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_to.street1', '965 Mission St.' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_to.city', 'San Francisco' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_to.state', 'CA' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_to.zip', '94105' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'address_to.country', 'US' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'parcels[0].length', '5' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'parcels[0].width', '5' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'parcels[0].height', '5' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'parcels[0].distance_unit', 'in' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'parcels[0].weight', '2' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'parcels[0].mass_unit', 'lb' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'async', 0 EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', 'ShippoToken <API_TOKEN>' EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json' DECLARE @resp int EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://api.goshippo.com/shipments/', '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 DECLARE @sbResponseBody int -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody DECLARE @jResp int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody EXEC sp_OASetProperty @jResp, 'EmitCompact', 0 PRINT 'Response Body:' EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT PRINT @sTmp0 DECLARE @respStatusCode int EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT PRINT 'Response Status Code = ' + @respStatusCode IF @respStatusCode >= 400 BEGIN PRINT 'Response Header:' EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT PRINT @sTmp0 PRINT 'Failed.' EXEC @hr = sp_OADestroy @resp EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @json EXEC @hr = sp_OADestroy @sbResponseBody EXEC @hr = sp_OADestroy @jResp RETURN END EXEC @hr = sp_OADestroy @resp -- Sample JSON response: -- (Sample code for parsing the JSON response is shown below) -- { -- "carrier_accounts": [ -- ], -- "object_created": "2019-06-28T17:45:20.441Z", -- "object_updated": "2019-06-28T17:45:20.511Z", -- "object_id": "17b01795a4884d8a9002ccc17c9d09d1", -- "object_owner": "admin@chilkatsoft.com", -- "status": "SUCCESS", -- "address_from": { -- "object_id": "427489906b604f498f7bd2429ab7d9a1", -- "is_complete": true, -- "name": "Mr. Hippo", -- "company": "", -- "street_no": "", -- "street1": "215 Clayton St.", -- "validation_results": {}, -- "street2": "", -- "street3": "", -- "city": "San Francisco", -- "state": "CA", -- "zip": "94117", -- "country": "US", -- "phone": "", -- "email": "", -- "is_residential": null, -- "test": true -- }, -- "address_to": { -- "object_id": "3d7166269a2844b7842ef9ace942ec7c", -- "is_complete": true, -- "name": "Mrs. Hippo", -- "company": "", -- "street_no": "", -- "street1": "965 Mission St.", -- "validation_results": {}, -- "street2": "", -- "street3": "", -- "city": "San Francisco", -- "state": "CA", -- "zip": "94105", -- "country": "US", -- "phone": "", -- "email": "", -- "is_residential": null, -- "test": true -- }, -- "parcels": [ -- { -- "object_state": "VALID", -- "object_created": "2019-06-28T17:45:20.411Z", -- "object_updated": "2019-06-28T17:45:20.455Z", -- "object_id": "5af766ff15684a4186b0e3c833348fac", -- "object_owner": "admin@chilkatsoft.com", -- "template": null, -- "extra": {}, -- "length": "5.0000", -- "width": "5.0000", -- "height": "5.0000", -- "distance_unit": "in", -- "weight": "2.0000", -- "mass_unit": "lb", -- "value_amount": null, -- "value_currency": null, -- "metadata": "", -- "line_items": [ -- ], -- "test": true -- } -- ], -- "shipment_date": "2019-06-28T17:45:20.511Z", -- "address_return": { -- "object_id": "427489906b604f498f7bd2429ab7d9a1", -- "is_complete": true, -- "name": "Mr. Hippo", -- "company": "", -- "street_no": "", -- "street1": "215 Clayton St.", -- "validation_results": {}, -- "street2": "", -- "street3": "", -- "city": "San Francisco", -- "state": "CA", -- "zip": "94117", -- "country": "US", -- "phone": "", -- "email": "", -- "is_residential": null, -- "test": true -- }, -- "alternate_address_to": null, -- "customs_declaration": null, -- "extra": {}, -- "rates": [ -- { -- "object_created": "2019-06-28T17:45:20.789Z", -- "object_id": "dd7556c284e8444294d2ab7099e662d2", -- "object_owner": "admin@chilkatsoft.com", -- "shipment": "17b01795a4884d8a9002ccc17c9d09d1", -- "attributes": [ -- "FASTEST" -- ], -- "amount": "22.78", -- "currency": "USD", -- "amount_local": "22.78", -- "currency_local": "USD", -- "provider": "USPS", -- "provider_image_75": "https://shippo-static.s3.amazonaws.com/providers/75/USPS.png", -- "provider_image_200": "https://shippo-static.s3.amazonaws.com/providers/200/USPS.png", -- "servicelevel": { -- "name": "Priority Mail Express", -- "token": "usps_priority_express", -- "terms": "" -- }, -- "estimated_days": 2, -- "arrives_by": null, -- "duration_terms": "Overnight delivery to most U.S. locations.", -- "messages": [ -- ], -- "carrier_account": "1f3dc340ad6c4991ad61f14fa3e4b82e", -- "test": true, -- "zone": "1" -- }, -- { -- "object_created": "2019-06-28T17:45:20.786Z", -- "object_id": "ec11cc297e2f4583986097f6d409e5c6", -- "object_owner": "admin@chilkatsoft.com", -- "shipment": "17b01795a4884d8a9002ccc17c9d09d1", -- "attributes": [ -- "BESTVALUE", -- "CHEAPEST", -- "FASTEST" -- ], -- "amount": "6.95", -- "currency": "USD", -- "amount_local": "6.95", -- "currency_local": "USD", -- "provider": "USPS", -- "provider_image_75": "https://shippo-static.s3.amazonaws.com/providers/75/USPS.png", -- "provider_image_200": "https://shippo-static.s3.amazonaws.com/providers/200/USPS.png", -- "servicelevel": { -- "name": "Priority Mail", -- "token": "usps_priority", -- "terms": "" -- }, -- "estimated_days": 2, -- "arrives_by": null, -- "duration_terms": "Delivery within 1, 2, or 3 days based on where your package started and where it’s being sent.", -- "messages": [ -- ], -- "carrier_account": "1f3dc340ad6c4991ad61f14fa3e4b82e", -- "test": true, -- "zone": "1" -- }, -- { -- "object_created": "2019-06-28T17:45:20.785Z", -- "object_id": "d256586f539f4c93a2f02cc11f4942ac", -- "object_owner": "admin@chilkatsoft.com", -- "shipment": "17b01795a4884d8a9002ccc17c9d09d1", -- "attributes": [ -- ], -- "amount": "7.32", -- "currency": "USD", -- "amount_local": "7.32", -- "currency_local": "USD", -- "provider": "USPS", -- "provider_image_75": "https://shippo-static.s3.amazonaws.com/providers/75/USPS.png", -- "provider_image_200": "https://shippo-static.s3.amazonaws.com/providers/200/USPS.png", -- "servicelevel": { -- "name": "Parcel Select", -- "token": "usps_parcel_select", -- "terms": "" -- }, -- "estimated_days": 7, -- "arrives_by": null, -- "duration_terms": "Delivery in 2 to 8 days.", -- "messages": [ -- ], -- "carrier_account": "1f3dc340ad6c4991ad61f14fa3e4b82e", -- "test": true, -- "zone": "1" -- } -- ], -- "messages": [ -- { -- "source": "DHLExpress", -- "code": "", -- "text": "Shippo's DHL Express master account doesn't support shipments to inside of the US" -- } -- ], -- "metadata": "", -- "test": true, -- "order": null -- } -- Sample code for parsing the JSON response... -- Use the following online tool to generate parsing code from sample JSON: -- Generate Parsing Code from JSON DECLARE @object_state nvarchar(4000) DECLARE @template nvarchar(4000) DECLARE @length nvarchar(4000) DECLARE @width nvarchar(4000) DECLARE @height nvarchar(4000) DECLARE @distance_unit nvarchar(4000) DECLARE @weight nvarchar(4000) DECLARE @mass_unit nvarchar(4000) DECLARE @value_amount nvarchar(4000) DECLARE @value_currency nvarchar(4000) DECLARE @j int DECLARE @count_j int DECLARE @shipment nvarchar(4000) DECLARE @amount nvarchar(4000) DECLARE @currency nvarchar(4000) DECLARE @amount_local nvarchar(4000) DECLARE @currency_local nvarchar(4000) DECLARE @provider nvarchar(4000) DECLARE @provider_image_75 nvarchar(4000) DECLARE @provider_image_200 nvarchar(4000) DECLARE @servicelevelName nvarchar(4000) DECLARE @servicelevelToken nvarchar(4000) DECLARE @servicelevelTerms nvarchar(4000) DECLARE @estimated_days int DECLARE @arrives_by nvarchar(4000) DECLARE @duration_terms nvarchar(4000) DECLARE @carrier_account nvarchar(4000) DECLARE @zone nvarchar(4000) DECLARE @strVal nvarchar(4000) DECLARE @source nvarchar(4000) DECLARE @code nvarchar(4000) DECLARE @text nvarchar(4000) DECLARE @object_created nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @object_created OUT, 'object_created' DECLARE @object_updated nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @object_updated OUT, 'object_updated' DECLARE @object_id nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @object_id OUT, 'object_id' DECLARE @object_owner nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @object_owner OUT, 'object_owner' DECLARE @status nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'status' DECLARE @address_fromObject_id nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromObject_id OUT, 'address_from.object_id' DECLARE @address_fromIs_complete int EXEC sp_OAMethod @jResp, 'BoolOf', @address_fromIs_complete OUT, 'address_from.is_complete' DECLARE @address_fromName nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromName OUT, 'address_from.name' DECLARE @address_fromCompany nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromCompany OUT, 'address_from.company' DECLARE @address_fromStreet_no nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromStreet_no OUT, 'address_from.street_no' DECLARE @address_fromStreet1 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromStreet1 OUT, 'address_from.street1' DECLARE @address_fromStreet2 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromStreet2 OUT, 'address_from.street2' DECLARE @address_fromStreet3 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromStreet3 OUT, 'address_from.street3' DECLARE @address_fromCity nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromCity OUT, 'address_from.city' DECLARE @address_fromState nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromState OUT, 'address_from.state' DECLARE @address_fromZip nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromZip OUT, 'address_from.zip' DECLARE @address_fromCountry nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromCountry OUT, 'address_from.country' DECLARE @address_fromPhone nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromPhone OUT, 'address_from.phone' DECLARE @address_fromEmail nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromEmail OUT, 'address_from.email' DECLARE @address_fromIs_residential nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_fromIs_residential OUT, 'address_from.is_residential' DECLARE @address_fromTest int EXEC sp_OAMethod @jResp, 'BoolOf', @address_fromTest OUT, 'address_from.test' DECLARE @address_toObject_id nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toObject_id OUT, 'address_to.object_id' DECLARE @address_toIs_complete int EXEC sp_OAMethod @jResp, 'BoolOf', @address_toIs_complete OUT, 'address_to.is_complete' DECLARE @address_toName nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toName OUT, 'address_to.name' DECLARE @address_toCompany nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toCompany OUT, 'address_to.company' DECLARE @address_toStreet_no nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toStreet_no OUT, 'address_to.street_no' DECLARE @address_toStreet1 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toStreet1 OUT, 'address_to.street1' DECLARE @address_toStreet2 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toStreet2 OUT, 'address_to.street2' DECLARE @address_toStreet3 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toStreet3 OUT, 'address_to.street3' DECLARE @address_toCity nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toCity OUT, 'address_to.city' DECLARE @address_toState nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toState OUT, 'address_to.state' DECLARE @address_toZip nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toZip OUT, 'address_to.zip' DECLARE @address_toCountry nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toCountry OUT, 'address_to.country' DECLARE @address_toPhone nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toPhone OUT, 'address_to.phone' DECLARE @address_toEmail nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toEmail OUT, 'address_to.email' DECLARE @address_toIs_residential nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_toIs_residential OUT, 'address_to.is_residential' DECLARE @address_toTest int EXEC sp_OAMethod @jResp, 'BoolOf', @address_toTest OUT, 'address_to.test' DECLARE @shipment_date nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @shipment_date OUT, 'shipment_date' DECLARE @address_returnObject_id nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnObject_id OUT, 'address_return.object_id' DECLARE @address_returnIs_complete int EXEC sp_OAMethod @jResp, 'BoolOf', @address_returnIs_complete OUT, 'address_return.is_complete' DECLARE @address_returnName nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnName OUT, 'address_return.name' DECLARE @address_returnCompany nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnCompany OUT, 'address_return.company' DECLARE @address_returnStreet_no nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnStreet_no OUT, 'address_return.street_no' DECLARE @address_returnStreet1 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnStreet1 OUT, 'address_return.street1' DECLARE @address_returnStreet2 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnStreet2 OUT, 'address_return.street2' DECLARE @address_returnStreet3 nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnStreet3 OUT, 'address_return.street3' DECLARE @address_returnCity nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnCity OUT, 'address_return.city' DECLARE @address_returnState nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnState OUT, 'address_return.state' DECLARE @address_returnZip nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnZip OUT, 'address_return.zip' DECLARE @address_returnCountry nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnCountry OUT, 'address_return.country' DECLARE @address_returnPhone nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnPhone OUT, 'address_return.phone' DECLARE @address_returnEmail nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnEmail OUT, 'address_return.email' DECLARE @address_returnIs_residential nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @address_returnIs_residential OUT, 'address_return.is_residential' DECLARE @address_returnTest int EXEC sp_OAMethod @jResp, 'BoolOf', @address_returnTest OUT, 'address_return.test' DECLARE @alternate_address_to nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @alternate_address_to OUT, 'alternate_address_to' DECLARE @customs_declaration nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @customs_declaration OUT, 'customs_declaration' DECLARE @metadata nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @metadata OUT, 'metadata' DECLARE @test int EXEC sp_OAMethod @jResp, 'BoolOf', @test OUT, 'test' DECLARE @order nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @order OUT, 'order' DECLARE @i int SELECT @i = 0 DECLARE @count_i int EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'carrier_accounts' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @jResp, 'I', @i SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'parcels' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @jResp, 'I', @i EXEC sp_OAMethod @jResp, 'StringOf', @object_state OUT, 'parcels[i].object_state' EXEC sp_OAMethod @jResp, 'StringOf', @object_created OUT, 'parcels[i].object_created' EXEC sp_OAMethod @jResp, 'StringOf', @object_updated OUT, 'parcels[i].object_updated' EXEC sp_OAMethod @jResp, 'StringOf', @object_id OUT, 'parcels[i].object_id' EXEC sp_OAMethod @jResp, 'StringOf', @object_owner OUT, 'parcels[i].object_owner' EXEC sp_OAMethod @jResp, 'StringOf', @template OUT, 'parcels[i].template' EXEC sp_OAMethod @jResp, 'StringOf', @length OUT, 'parcels[i].length' EXEC sp_OAMethod @jResp, 'StringOf', @width OUT, 'parcels[i].width' EXEC sp_OAMethod @jResp, 'StringOf', @height OUT, 'parcels[i].height' EXEC sp_OAMethod @jResp, 'StringOf', @distance_unit OUT, 'parcels[i].distance_unit' EXEC sp_OAMethod @jResp, 'StringOf', @weight OUT, 'parcels[i].weight' EXEC sp_OAMethod @jResp, 'StringOf', @mass_unit OUT, 'parcels[i].mass_unit' EXEC sp_OAMethod @jResp, 'StringOf', @value_amount OUT, 'parcels[i].value_amount' EXEC sp_OAMethod @jResp, 'StringOf', @value_currency OUT, 'parcels[i].value_currency' EXEC sp_OAMethod @jResp, 'StringOf', @metadata OUT, 'parcels[i].metadata' EXEC sp_OAMethod @jResp, 'BoolOf', @test OUT, 'parcels[i].test' SELECT @j = 0 EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'parcels[i].line_items' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @jResp, 'J', @j SELECT @j = @j + 1 END SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'rates' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @jResp, 'I', @i EXEC sp_OAMethod @jResp, 'StringOf', @object_created OUT, 'rates[i].object_created' EXEC sp_OAMethod @jResp, 'StringOf', @object_id OUT, 'rates[i].object_id' EXEC sp_OAMethod @jResp, 'StringOf', @object_owner OUT, 'rates[i].object_owner' EXEC sp_OAMethod @jResp, 'StringOf', @shipment OUT, 'rates[i].shipment' EXEC sp_OAMethod @jResp, 'StringOf', @amount OUT, 'rates[i].amount' EXEC sp_OAMethod @jResp, 'StringOf', @currency OUT, 'rates[i].currency' EXEC sp_OAMethod @jResp, 'StringOf', @amount_local OUT, 'rates[i].amount_local' EXEC sp_OAMethod @jResp, 'StringOf', @currency_local OUT, 'rates[i].currency_local' EXEC sp_OAMethod @jResp, 'StringOf', @provider OUT, 'rates[i].provider' EXEC sp_OAMethod @jResp, 'StringOf', @provider_image_75 OUT, 'rates[i].provider_image_75' EXEC sp_OAMethod @jResp, 'StringOf', @provider_image_200 OUT, 'rates[i].provider_image_200' EXEC sp_OAMethod @jResp, 'StringOf', @servicelevelName OUT, 'rates[i].servicelevel.name' EXEC sp_OAMethod @jResp, 'StringOf', @servicelevelToken OUT, 'rates[i].servicelevel.token' EXEC sp_OAMethod @jResp, 'StringOf', @servicelevelTerms OUT, 'rates[i].servicelevel.terms' EXEC sp_OAMethod @jResp, 'IntOf', @estimated_days OUT, 'rates[i].estimated_days' EXEC sp_OAMethod @jResp, 'StringOf', @arrives_by OUT, 'rates[i].arrives_by' EXEC sp_OAMethod @jResp, 'StringOf', @duration_terms OUT, 'rates[i].duration_terms' EXEC sp_OAMethod @jResp, 'StringOf', @carrier_account OUT, 'rates[i].carrier_account' EXEC sp_OAMethod @jResp, 'BoolOf', @test OUT, 'rates[i].test' EXEC sp_OAMethod @jResp, 'StringOf', @zone OUT, 'rates[i].zone' SELECT @j = 0 EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'rates[i].attributes' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @jResp, 'J', @j EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'rates[i].attributes[j]' SELECT @j = @j + 1 END SELECT @j = 0 EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'rates[i].messages' WHILE @j < @count_j BEGIN EXEC sp_OASetProperty @jResp, 'J', @j SELECT @j = @j + 1 END SELECT @i = @i + 1 END SELECT @i = 0 EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'messages' WHILE @i < @count_i BEGIN EXEC sp_OASetProperty @jResp, 'I', @i EXEC sp_OAMethod @jResp, 'StringOf', @source OUT, 'messages[i].source' EXEC sp_OAMethod @jResp, 'StringOf', @code OUT, 'messages[i].code' EXEC sp_OAMethod @jResp, 'StringOf', @text OUT, 'messages[i].text' SELECT @i = @i + 1 END EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @json EXEC @hr = sp_OADestroy @sbResponseBody EXEC @hr = sp_OADestroy @jResp END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.