【问题标题】:USPS - How do I get international shipping rates via the API?USPS - 如何通过 API 获取国际运费?
【发布时间】:2011-10-19 11:11:33
【问题描述】:

我正在尝试通过http://production.shippingapis.com/ShippingAPI.dll 的 USPS API 获取国际运费报价我有一个用户名和帐号,并且可以成功地使用 API 来获取国内运费报价。但是我找不到国际报价信息。

USPS 网站似乎无处可去,当然也无助于找到我需要的东西。

这里是 USPS 开发指南 PDF 的链接。我没有看到任何有关国际运输的信息。 https://www.usps.com/webtools/_pdf/Development-Guide-v3-1.pdf

您可以在哪里获得有关获取 USPS 国际运费报价的信息吗?

【问题讨论】:

    标签: xml usps


    【解决方案1】:

    我认为有各种 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>
    

    【讨论】:

    • 为了我的一生,我找不到它。这是确切的正确答案。非常感谢!
    • 将在 :-) 中放置一个 lmgtfy 链接。但实际上界面非常有趣,并且有详细的规范和 API。我见过的记录较好的文件之一。我想知道新西兰当地的邮局是什么样的。
    • 我得到了太多 lmgtfy 的答案。在向 stackoverflow.com 寻求帮助之前,我通常会进行大量研究。我能够从您的答案中准确找到我需要的东西,并且我到处寻找答案。再次感谢您的帮助。
    • 费率计算器 PDF 已更新,这是当前的,至少在 2013 年 1 月之前:usps.com/webtools/_pdf/Rate-Calculators-v1-5.pdf
    猜你喜欢
    • 1970-01-01
    • 2020-01-26
    • 2016-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-18
    相关资源
    最近更新 更多