标签: usps

USPS:API授权失败

为什么费率不适用于USPS?我正在使用ratev4,我收到一个错误:

错误:

API Authorization failure. RateV4 is not a valid API name for this protocol.
UspsCom::DoAuth
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

<?php
$devurl = "testing.shippingapis.com/ShippingAPITest.dll";
$puburl = "https://secure.shippingapis.com/ShippingAPITest.dll";

$service = "RateV4";
$userid = "690DEVBL1739";

$xml = rawurlencode('<RateV4Request USERID="xxxxx">
    <Revision/>
    <Package ID="1ST">
        <Service>FIRST CLASS</Service>
        <FirstClassMailType>LETTER</FirstClassMailType>
        <ZipOrigination>44106</ZipOrigination>
        <ZipDestination>20770</ZipDestination>
        <Pounds>1</Pounds>
        <Ounces>0.0</Ounces> 
        <Container/>
        <Size>REGULAR</Size> 
        <Machinable>true</Machinable>
    </Package>
    </RateV4Request>');

    $request = $devurl . "?API=" . $service . "&xml=" . $xml;


    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $request);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);



    $response = curl_exec($ch);
    curl_close($ch);

    echo …
Run Code Online (Sandbox Code Playgroud)

php api usps

11
推荐指数
3
解决办法
9141
查看次数

来自USPS费率计算器的回复

我需要从USPS获得运费.

我已经注册了他们,得到了自己的用户ID,并尝试使用示例请求XML,如页面所示 - https://www.usps.com/webtools/htm/Rate-Calculators-v1-3.htm ,但继续得到以下错误响应.

<Error>
<Number>80040b1a</Number>
<Description>API Authorization failure. RateV4 is not a valid API name for this protocol.</Description>
<Source>UspsCom::DoAuth</Source>
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚我在哪里错过了这一点.谷歌也没有帮助:-(

我将API名称作为RateV4传递.我也尝试过使用国际运输API - IntlRateV2.是的,我也尝试过安全https://secure.shippingapis.com/ShippingAPITest.dll api.我已经邮寄给支持人员.没有任何效果.

一旦这个基本的东西工作,我计划获取类并使用自定义序列化来序列化我的请求,然后反序列化响应.这比直接使用XML更好.但这可能更适合作为其他问题.让基本的东西工作是一件令人担忧的问题.谢谢

.net c# vb.net web-services usps

8
推荐指数
1
解决办法
3917
查看次数

将USPS eVSCertifyRequest错误传递为数据库中未找到的MasterMID

使用eVSCertifyRequest创建USPS标签,我传递参数如下:

https://secure.shippingapis.com/ShippingAPI.dll?API=eVSCertify&XML=<eVSCertifyRequest USERID="XXXXXXXX">
<Option>1</Option>
<Revision></Revision>
<ImageParameters>
    <ImageParameter>4X6LABEL</ImageParameter>
</ImageParameters>
<FromName>Mitesh Jain</FromName>
<FromFirm>Mitesh Jain</FromFirm>
<FromAddress1>52 NORMANDY RD</FromAddress1>
<FromAddress2>QWE</FromAddress2>
<FromCity>MARLTON</FromCity>
<FromState>NJ</FromState>
<FromZip5>08053</FromZip5>
<FromZip4>0805</FromZip4>
<FromPhone>1234567890</FromPhone>
<POZipCode></POZipCode>
<AllowNonCleansedOriginAddr>false</AllowNonCleansedOriginAddr>
<ToName>JRC,LLC</ToName>
<ToFirm>JRC,LLC</ToFirm>
<ToAddress1>110 South 8th Street</ToAddress1>
<ToAddress2>Suite 104</ToAddress2>
<ToCity>Philadelphia</ToCity>
<ToState>PA</ToState>
<ToZip5>15001</ToZip5>
<ToZip4>1500</ToZip4>
<ToPhone>0123456789</ToPhone>
<POBox></POBox>
<AllowNonCleansedDestAddr>false</AllowNonCleansedDestAddr>
<WeightInOunces>1</WeightInOunces>
<ServiceType>PRIORITY</ServiceType>
<Container>FLAT RATE ENVELOPE</Container>
<Width></Width>
<Length></Length>
<Height></Height>
<Machinable></Machinable>
<ProcessingCategory></ProcessingCategory>
<PriceOptions></PriceOptions>
<InsuredAmount></InsuredAmount>
<AddressServiceRequested></AddressServiceRequested>
<ExpressMailOptions>
    <DeliveryOption></DeliveryOption>
    <WaiverOfSignature></WaiverOfSignature>
</ExpressMailOptions>
<ShipDate></ShipDate>
<CustomerRefNo></CustomerRefNo>
<ExtraServices>
    <ExtraService></ExtraService>
</ExtraServices>
<HoldForPickup></HoldForPickup>
<OpenDistribute></OpenDistribute>
<PermitNumber></PermitNumber>
<PermitZIPCode></PermitZIPCode>
<PermitHolderName></PermitHolderName>
<CRID></CRID>
<MID>847654321</MID>
<SenderName></SenderName>
<SenderEMail></SenderEMail>
<RecipientName></RecipientName>
<RecipientEMail></RecipientEMail>
<ReceiptOption></ReceiptOption>
<ImageType>PDF</ImageType>
<HoldForManifest>Y</HoldForManifest>
<NineDigitRoutingZip>false</NineDigitRoutingZip>
<Content>
    <ContentType>HAZMAT</ContentType>
</Content>
Run Code Online (Sandbox Code Playgroud)

但我收到的错误如下

 <?xml …
Run Code Online (Sandbox Code Playgroud)

c# xml asp.net usps

8
推荐指数
1
解决办法
607
查看次数

USPS 运费 API 限制

我正在努力在产品页面上显示运费,例如在亚马逊和 eBay。

但是,因为我会比通常的购物车页面更多地调用 API,我想知道 USPS API 是否有任何限制可以阻止我在产品页面上使用 API?

你认为我应该使用某种离线处理吗?

api usps

6
推荐指数
1
解决办法
3594
查看次数

是否有适用于任何语言的全功能开源发货库(Fedex/UPS/USPS)?

我正在尝试为一个更大的应用程序创建一个小型Web服务来处理一些常见的运输操作(费率,包创建,标签),因此我在选择一种语言来编写它时非常灵活(Python,Ruby) ,Java,Perl,甚至PHP,如果有必要的话).但我还没有找到任何支持该愿望清单的一个不错的子集的库或模块.shopify的Active Shipping仅支持跟踪和获取费率.大多数CPAN模块都很古老......我可以自己做标签打印,只是一个ZPL模板的例子.但实际上创造出货的东西真的非常有用.许多不同的API调用,运输方法之间的差异等.

如果它足够灵活,也许可以从某些网店软件中取出一些东西.我不敢相信没有人为此写过一个全面的包装器.

ups fedex shipping usps

5
推荐指数
0
解决办法
4948
查看次数

从5位邮政编码获得9位数的邮政编码,programmatic,api

我有5位数的邮政编码,这些邮政编码是从谷歌地图Api中检索出来的.

我的困境是我必须连接到一个也包含地址的远程数据库.如果该数据库中不存在该地址,我必须编写它,如果它存在,那么除了存储数据库已分配给该地址的ID之外,我什么都不做.问题出现,因为检查此数据库的api不带通配符,该数据库中的地址有9位邮政编码(5 + 4),并且不会返回地址的其余部分与我的地址匹配5位邮政编码.

远程系统会告诉我该地址与我发送的地址不存在.

因此,为了防止将重复地址写入数据库,我需要在发送之前找到我所拥有的9位数的邮政编码.

怎么做?是否有确定5位数地址的最后4位数的公式?USPS是否有API?人口普查是否有一张巨大的桌子?

洞察力赞赏

api usps geocode street-address google-geocoder

5
推荐指数
1
解决办法
2万
查看次数

USPS 地址验证 API 中的授权失败

只是我有一个在USPS注册的文件,它提供US Address Validation API. 我正在使用以下代码来获取XML Response.

但是,不幸的是,它Response说:

授权失败用户“xxxxxxxxx”无权使用 API Verify.USPSCOM::DoAuth。

我错过了什么吗?

代码:

void IsValidAddress()
{
    string USPS = "http://production.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest%20USERID='xxxxxxx'><Address ID='1'><Address1></Address1><Address2>8 Wildwood Drive</Address2><City>Old Lyme</City><State>CT</State><Zip5>06371</Zip5><Zip4></Zip4></Address></AddressValidateRequest>";
    WebClient wsClient = new WebClient();

    byte[] responseData = wsClient.DownloadData(USPS);

    string response = string.Empty;

    foreach (byte item in responseData)
    {
        //this will return the xml response
        response += (char)item;
    }
    string result = response;
    Response.Write(result);
}
Run Code Online (Sandbox Code Playgroud)

请参阅:如何在 USPS 上验证地址

注意:User ID是我的个人用户 ID,由 USPS 服务提供商颁发。

c# validation usps

5
推荐指数
1
解决办法
1872
查看次数

使用PHP获取USPS订单跟踪状态

尝试使用USPS Tracking API检索USPS订单的状态时抛出错误.

但是,当运行我根据USPS手册构建的代码时,我收到以下错误:" 80040B19XML语法错误:请检查XML请求以查看是否可以解析.USPSCOM :: DoAuth "

链接到手册:https://www.usps.com/business/web-tools-apis/track-and-confirm-v1-3a.htm

这是我的代码:

$trackingNumber = 123456;
$url = "http://production.shippingapis.com/shippingAPI.dll";
$service = "TrackV2";
$xml = rawurlencode("
<TrackRequest USERID='MYID'>
    <TrackID ID=".$trackingNumber."></TrackID>
    </TrackRequest>");
$request = $url . "?API=" . $service . "&XML=" . $xml;
// send the POST values to USPS
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$request);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// parameters to post

$result = curl_exec($ch);
//var_dump($result);
curl_close($ch);

$response = new SimpleXMLElement($result);
//print_r($result);
$deliveryStatus = $response->TrackResponse->TrackInfo->Status;
echo …
Run Code Online (Sandbox Code Playgroud)

php api curl tracking usps

5
推荐指数
1
解决办法
4310
查看次数

问题元素'ImageParameters'不能包含子元素'ImageParameter'

我试图用4x6生成usps标签,但我正面临这个问题.任何人都可以帮我生成4x6Label.

我还尝试将版本从DeliveryConfirmationV3更改为DeliveryConfirmationV4,但仍然没有生成4x6Label.

我的xml请求传递为

https://secure.shippingapis.com/ShippingAPI.dll?API=DeliveryConfirmationV3&XML=<DeliveryConfirmationV3.0Request USERID="xxxxx" PASSWORD="xxxxxx">
<Option>1</Option>
<ImageParameters>
    <ImageParameter>4X6LABEL</ImageParameter>
</ImageParameters>
<FromName>Mitesh1 Jain1</FromName>
<FromFirm></FromFirm>
<FromAddress1>52 NORMANDY RD</FromAddress1>
<FromAddress2>QWE</FromAddress2>
<FromCity>MARLTON</FromCity>
<FromState>NJ</FromState>
<FromZip5>08053</FromZip5>
<FromZip4></FromZip4>
<ToName>DISCRETE JRC,LLC</ToName>
<ToFirm></ToFirm>
<ToAddress1>110 South 8th Street</ToAddress1>
<ToAddress2>Suite 104</ToAddress2>
<ToCity>Philadelphia</ToCity>
<ToState>PA</ToState>
<ToZip5>15001</ToZip5>
<ToZip4></ToZip4>
<WeightInOunces>1</WeightInOunces>
<ServiceType>Priority</ServiceType>
<POZipCode></POZipCode>
<ImageType>PDF</ImageType>
<LabelDate></LabelDate>
<CustomerRefNo></CustomerRefNo>
<AddressServiceRequested>False</AddressServiceRequested>
<SenderName></SenderName>
<SenderEMail></SenderEMail>
<RecipientName></RecipientName>
<RecipientEMail></RecipientEMail>
</DeliveryConfirmationV3.0Request>
Run Code Online (Sandbox Code Playgroud)

但我收到的错误是

<?xml version="1.0" encoding="utf-8"?>
<Error>
<Number>-2147221202</Number>
<Source>Common:XmlParse</Source>
<Description>The element 'ImageParameters' cannot contain child element 'ImageParameter' because the parent element's content model is text only.</Description>
 <HelpFile/>
 <HelpContext/>
Run Code Online (Sandbox Code Playgroud)

最初它完美地工作但是在通过之后

<ImageParameter>4X6LABEL</ImageParameter>
Run Code Online (Sandbox Code Playgroud)

这个问题出现了

目前我的代码是

   public Package GetDeliveryConfirmationLabel(Package package) …
Run Code Online (Sandbox Code Playgroud)

.net c# xml usps

5
推荐指数
1
解决办法
198
查看次数

USPS API returning 80040B19 error code and Account is in Production

so my issue is according to the documentation (wich is pretty slim and not the greatest) the xml i have is everything that is required, but im getting this error code back

<?xml version="1.0" encoding="UTF-8"?>
<Error><Number>80040B19</Number><Description>XML Syntax Error: Please check the XML request to see if it can be parsed.</Description><Source>USPSCOM::DoAuth</Source></Error>
Run Code Online (Sandbox Code Playgroud)

这对我来说没有多大意义,因为我的帐户处于生产模式,而且正如我根据文档所说,我拥有所需的一切,我花了最后两天的时间使此功能正常工作。

VerifyAddress函数工作正常,但RateCheck函数不起作用。

class USPS
    {
        protected $Endpoint = 'http://production.shippingapis.com/ShippingAPI.dll';
        protected $SecureEndpoint = 'https://secure.shippingapis.com/ShippingAPI.dll';
        protected $TestEndpoint = 'http://stg-production.shippingapis.com/ShippingAPI.dll';
        protected $TestSecureEndpoint = 'https://stg-secure.shippingapis.com/ShippingAPI.dll';
        private $username = 'example’;

        function VerifyAddress($address1, $address2, $city, $state, …
Run Code Online (Sandbox Code Playgroud)

php curl usps

4
推荐指数
1
解决办法
4147
查看次数