![]() Postal Service does not prohibit the reuse and/or distribution of the API documentation (User's Guide) with sample code in order to generate awareness, encourage use or provide ease-of-use to customers or affiliates. You may not package any APIs with your User ID for resale or distribution to others. As per the Terms and Conditions of Use Agreement you agreed to during the Web Tools registration process, you are responsible to maintain the confidentiality of your User ID as specified. The Web Tools User ID provided is for you and your company to use when requesting data via the Internet from the U.S. SecuritySchemes have been omitted in the OpenAPI specification used to generate this documentation. Note: USPS Web Tools API does not follow standard OAuth, OpenID or Basic Authentication patterns. USPS official Developers Guide - PDF format. ![]() You'll receive an email with your Web Tools username (This is your USERID) Register on the USPS Web Tools API Portal for your Web Tools ID. The USERID attribute to the outermost XML element and set the value equal to your Web Tools User ID. Package.ShippingLabel = Convert.FromBase64String(xml.USPS Web Tools API are accessible using your Web Tools User ID. 'package.ShippingLabel = StringToUTF8ByteArray(xml.Substring(i1, i2 - i1)) 4, (), package.OriginZipcode, (), labeldate, _ĭim xml As String = web.DownloadString(url)ĭim idx1 As Integer = xml.IndexOf(" ") + 13ĭim errDesc As String = xml.Substring(idx1, idx2 - idx1)ĭim i1 As Integer = xml.IndexOf(" ") + 27 Format(url, Me._userid, CInt(package.LabelType),, , 1, _ If () = () Thenĭim url As String = "?API=ExpressMailLabelCertify&XML= " Public Function GetExpressMailConfirmationLabel(package As Package) As Packageĭim labeldate As String = () I have updated the source code to include the XML Parser version of the FromXML method on the Address object. I will look into this and make changes to the code accordingly. It appears that USPS may have changed some of the behaviour of their Web services. Note: If you want to test the other label methods, you will need to download the Guides from the USPS Web Tools site and use the sample data they provide. P.PackageType = PackageType.Flat_Rate_Box P.ToAddress.Address2 = " 6060 PRIMACY PKWY" P.FromAddress.Address2 = " 475 L'Enfant Plaza, SW" USPSManager m = new USPSManager( " YOUR_USER_ID", true) / true if you want to use the USPS Test Servers. / your USPS Web Tools User ID and the second is / The constructor takes 2 arguments, the first is / Create a new instance of the USPS Manager class Once you have tested your application, you can request your profile to be updated by USPS to access the production environment, where you can use any appropriate data. If you change the address or anything else, you will get an error. Note: If you are using the USPS Test servers, then the data in the examples below are the only data that will work. You can do this by filling out this form. ![]() Please keep in mind that this is my first CodeProject article, so go easy! :) USPS Web Toolsīefore you can use this library, you will need to get a USPS Web Tools ID. (This library will work in ASP.NET Web applications also.) The USPS Web tools are fairly easy to integrate, but I wanted to create a reusable component that I could use in future projects. I was in need of a library that would integrate the USPS Web Tools into my Windows form application. I will post them here on The Code Project when I am finished, but you can check this Web site until then for updates and to contact me directly. The DHL version should be the next one I release. UPDATE: I am working on a FedEx, UPS and DHL version of this tool. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |