2011-08-03 18 views
3

我試圖通過美國郵政API在http://production.shippingapis.com/ShippingAPI.dll獲得國際航運費率報價我有一個用戶名和賬號,並可以成功地使用API​​爲國內利率報價。雖然我找不到國際匯率報價信息。USPS - 如何通過API獲得國際運費?

的USPS網站似乎無處可去,肯定是沒有幫助找到我所需要的。

這裏是一個鏈接的USPS開發指南PDF。我沒有看到有關國際航運的任何信息。 https://www.usps.com/webtools/_pdf/Development-Guide-v3-1.pdf

你在那裏我可以得到約USPS國際航運費率報價的信息?

回答

7

有各種API的我想。看着Ecommerce API Technical Guides Website for USPS.COM。我看到這個Rate Calulator techinical guide

呼叫的類型爲:

http://production.shippingapis.com/ShippingAPI.dll?API=InitRateV2&XML= ... 

而且有規格和樣品稱那裏。

這是一個示例請求:

<IntlRateV2Request USERID="xxx"> 
    <Package ID="1ST"> 
    <Pounds>15</Pounds> 
    <Ounces>0</Ounces> 
    <Machinable>True</Machinable> 
    <MailType>Package</MailType> 
    <GXG> 
      <POBoxFlag>Y</POBoxFlag> 
      <GiftFlag>Y</GiftFlag> 
    </GXG> 
    <ValueOfContents>200</ValueOfContents> 
    <Country>Canada</Country> 
    <Container>RECTANGULAR</Container> 
    <Size>LARGE</Size> 
    <Width>10</Width> 
    <Length>15</Length> 
    <Height>10</Height> 
    <Girth>0</Girth> 
    <CommercialFlag>N</CommercialFlag> 
    </Package> 
    <Package ID="2ND"> 
    <Pounds>0</Pounds> 
    <Ounces>3</Ounces> 
    <MailType>Envelope</MailType> 
    <ValueOfContents>750</ValueOfContents> 
    <Country>Algeria</Country> 
    <Container></Container> 
    <Size>REGULAR</Size> 
    <Width></Width> 
    <Length></Length> 
    <Height></Height> 
    <Girth></Girth> 
    <CommercialFlag>N</CommercialFlag> 
    </Package> 
</IntlRateV2Request> 

樣本響應是相當大的,並且在文檔,但看起來像

<IntlRateV2Response> 
    <Package ID="1ST"> 
    <Prohibitions>An issue of a publication <!--2143 suppressed-->.</Prohibitions> 
    <Restrictions>Coins; banknotes; curren<!--1558 suppressed--> </Restrictions> 
    <Observations>1. Banknotes valued at <!--3059 suppressed-->.</Observations> 
    <CustomsForms>First-Class Mail Intern <!--358 suppressed-->)</CustomsForms> 
    <ExpressMail>Country Code: CA Recipro<!--2036 suppressed--> </ExpressMail> 
    <AreasServed>Please reference Express Mail for Areas Served.</AreasServed> 
    <AdditionalRestrictions>No Additional Restrictions Data found.</AdditionalRestrictions> 
     <Service ID="4"> 
     <Pounds>15</Pounds> 
     <Ounces>0</Ounces> 
     <Machinable>True</Machinable> 
     <MailType>Package</MailType> 
      <GXG> 
     <POBoxFlag>Y</POBoxFlag>   <GiftFlag>Y</GiftFlag> 
     </GXG> 
     <Container>RECTANGULAR</Container> 
     <Size>LARGE</Size> 
     <Width>10</Width> 
     <Length>15</Length> 
     <Height>10</Height> 
     <Girth>0</Girth> 
     <Country>CANADA</Country> 
     <Postage>112.50</Postage> 
     <ExtraServices> 
      <ExtraService> 
      <ServiceID>1</ServiceID> 
      <ServiceName>Insurance</ServiceName> 
      <Available>True</Available> 
      <Price>1.00</Price> 
     </ExtraService> 
     </ExtraServices> 
     <ValueOfContents>200.00</ValueOfContents> 
     <SvcCommitments>1 - 3 business days</SvcCommitments> 
     <SvcDescription>Global Express Guaranteed&lt;sup&gt;&amp;reg;&lt;/sup&gt; (GXG)**</SvcDescription> 
     <MaxDimensions>Max. length 46", width 35", height 46" and max. length plus girth combined 108"</MaxDimensions> 
     <MaxWeight>70</MaxWeight> 
    </Service> 
</Package> 
</IntlRateV2Response> 
+0

對於我的生命,我找不到它。這是完全正確的答案。非常感謝! –

+0

打算把一個lmgtfy鏈接放在:-)。但實際上界面非常有趣,並且有詳細的規格和API。我見過的更好的記錄之一。我想知道當地的新西蘭郵政是什麼樣的。 –

+1

我已經得到太多lmgtfy的答案。在轉向stackoverflow.com尋求幫助之前,我通常會進行一系列的研究。我能夠從你的回答中準確找到我需要的東西,並且我到處搜尋了一個答案。再次感謝您的幫助。 –

相關問題