Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fedex Direct API

Status
Not open for further replies.

togatown

Technical User
Jun 23, 2003
65
0
0
US
Is anyopne using this??

I am succesfully using the USPS and UPS APIs to return rates to my site but Fedex's documentation SUCKS! Several hundred pages and not even a URL to the app server...

Help....

Thanks
 
Thanks Dashley,

Have the URL, just that the fedex docs are very broad in their scope and I don't want to read hundreds of pages of non-pertinant info just to grab rates....

I guess I was looking for specific examples or snippets..
 
I actually had 2 programmers working with the fedex api for 4 months. Hope I'm not discouraging you, but we did get it done. I have all the code. Let me know if I can help you.
 
That would be great, all I need is the rate lookups. I downloaded the xml transactions guide and groaned when I aw it was 222 pages.

At least UPS breaks there guides into the specific functions you are looking to do ie. tracking, shipping, etc..

The guide was designed more specifically for use with the Ship Manager API (as they call it) which is installed on your server not the Ship Manager Direct (again they verbiage) which allows xml request into there server thru code.

This is what I am trying to do and only for shipping rate based on weight for a website I am (voluntarily mind you, hence the reluctance to read the whole guide) working on. I didn't even see the url for the server in the guide so where does one send the xml request to?

If you could post some samples of rate lookup code that would be great. Thanks btween.

Toga
 
toga,

I understand what you mean they do like to document. I did find some test code on an old CD that may point you in the right direction. What you want is to code a rate transaction. Grab the fedex record detail layout and look up the rate transaction recordlayout detail to verify they havent changed it (which I doubt).

The biggest hurdle is constructing the rate transaction without flaw. Once you do you just send it to FEDEX's server. In the code I have pasted below we had an in house server with our own account and meter number(which Identified our server). Please not the code was at best very basic and used for a test only. It worked.There are so many variables to throw at fedex to identify the shipment it can get frustrating. I'd take btween up on the code offer too.


Heres the code.

'Declare the "FedExAPIClient.dll" procedures
Private Declare Function FedExAPIInit Lib "FedExAPIClient.dll" _
() As Long

Private Declare Function FedExAPITransaction Lib "FedExAPIClient.dll" _
(ByVal ipAddress As String, ByVal port As Long, _
ByVal sendBuffer As Any, ByVal sendLength As Long, _
ByVal universalTransID As Long, ByVal recBuffer As String, ByVal _
recLength As Long, ByRef actLength As Long) As Long

Private Declare Function FedExAPIRelease Lib "FedExAPIClient.dll" () As Long

Private Sub Command1_Click()
'Debug.Print getResponse("0,""022""1,""RateTransaction""498,""account No Goes here""3025,""FDXE""8,""TN""9,""37803""117,""US""10,""237120213""16,""TN""17,""37801""50,""US""75,""LBS""1401,""10""24,""20030528""116,""1""1415,""10""68,""USD""1274,""03""99,""""", 2017)

Debug.Print getResponse("0,""211""1,""1st Transaction""4003,""Gregdohgle""4007,""ACNtv""4011,""Knoxville""4008,""10001 KingstonPk.""4015,""8653890416""4012,""TN""10,""237120213""4013,""37922""4014,""US""99,""""", 3003)
End Sub


Public Function getResponse(ByVal rq As String, transID As Long) As String
Dim reply As String, t As Long, x As Long, actualLen As Long
reply = String(300, 0)
Debug.Print rq
x = FedExAPITransaction("192.168.0.202", 8190, rq, Len(rq), 1, reply, Len(reply), actualLen)
Debug.Print reply
End Function
 
Dash,

Thanks again but I beleive you misunderstood, I am not the best at explaining sometimes.

I am looking to use the xml tools not the com object.

Part of the problem is Fedex, the Ship Manager APIs are the server side installable tools and the Ship Manager Direct requires no installation on your server. The direct tools allow you to send a direct xml request from your code without the dll installed and receive a direct xml response. This is what I am trying to use.

If I have to install the API tools on my production server, I won't use Fedex, they're the ones that lose not me, it's not like they are any cheaper than anyone else... :) I have no bias towards one shipper or the other.

Given my choice I would only use the USPS as their rates are usually lower and their service range is broader. Unfortunately my client/friend is a gun broker and certain items (pistols and pistol frames) can not be shipped via the post office. These items must be shipped overnight to another dealer using a RELIABLE, TRACKABLE (obviously this rules out USPS, their tracking sucks) shipper according to ATF, controlled items and all. So....Fedex or UPS.

Unfortunately, there are some small towns where overnight service is available from Fedex but not UPS.

Toga
 
TOGA,

Ok I understand. I dont have anything on the xml tools.
I understand what you mean about FEDEX. They were famous for dropping packages off at UPS for rurral areas and then charging a rural delivery surcrarge after the fact HA. We shipped 15,000 avg. packages daily most went USPS. They had dsigniture delivery confermation that was pretty good. We didnt use much UPS because we were shipping alot of loose gemstones which UPS didnt take.

Well good luck to ya.

Dan
 
Thanks Dash,

Damn! 15,000! I hope we hit that in 5 years... ;) They all have their own little strange rules, makes the shipping part of the web site a minor headache, had to add several columns to the db to account or all the shipping rules and exceptions. told my buddy he'd be better off selling stuffed animals....

Toga
 
Toga,

Post you request to FEDEX test server

You will need to fill in your FEDEX account information below and package info.

hope this is what you need.


<?xml version="1.0" encoding="UTF-8" ?>
<FDXRateAvailableServicesRequest xmlns:api=" xmlns:xsi=" xsi:noNamespaceSchemaLocation="FDXRateRequest.xsd">
<RequestHeader>
<CustomerTransactionIdentifier></CustomerTransactionIdentifier>
<AccountNumber><![CDATA[ ]]></AccountNumber>
<MeterNumber><![CDATA[ ]]></MeterNumber>
<CarrierCode><![CDATA[ ]]></CarrierCode>
</RequestHeader>
<ShipDate><![CDATA[ ]]></ShipDate>
<ReturnShipmentIndicator></ReturnShipmentIndicator>
<DropoffType><![CDATA[ ]]></DropoffType>
<Service></Service>
<Packaging><![CDATA[ ]]></Packaging>
<WeightUnits><![CDATA[ ]]></WeightUnits>
<Weight><![CDATA[ ]]></Weight>
<ListRate><![CDATA[ ]]></ListRate>
<OriginAddress>
<StateOrProvinceCode><![CDATA[ ]]></StateOrProvinceCode>
<PostalCode><![CDATA[ ]]></PostalCode>
<CountryCode><![CDATA[ ]]></CountryCode>
</OriginAddress>
<DestinationAddress>
<StateOrProvinceCode><![CDATA[ ]]></StateOrProvinceCode>
<PostalCode><![CDATA[ ]]></PostalCode>
<CountryCode><![CDATA[ ]]></CountryCode>
</DestinationAddress>
<Payment>
<PayorType><![CDATA[ ]]></PayorType>
</Payment>
<Dimensions>
<Length></Length>
<Width></Width>
<Height></Height>
<Units></Units>
</Dimensions>
<DeclaredValue>
<Value></Value>
<CurrencyCode></CurrencyCode>
</DeclaredValue>
<SpecialServices>
<COD>
<CollectionAmount></CollectionAmount>
<CollectionType></CollectionType>
</COD>
<HoldAtLocation></HoldAtLocation>
<DangerousGoods>
<Accessibility></Accessibility>
</DangerousGoods>
<DryIce></DryIce>
<ResidentialDelivery></ResidentialDelivery>
<ResidentialPickup></ResidentialPickup>
<InsidePickup></InsidePickup>
<InsideDelivery></InsideDelivery>
<SaturdayPickup></SaturdayPickup>
<SaturdayDelivery></SaturdayDelivery>
<AOD></AOD>
<AutoPOD></AutoPOD>
<NonstandardContainer></NonstandardContainer>
</SpecialServices>
<HomeDelivery>
<Type></Type>
<SignatureRequired></SignatureRequired>
<PackageCount></PackageCount>
</HomeDelivery>
<VariableHandlingCharges>
<Level></Level>
<Type></Type>
<AmountOrPercentage></AmountOrPercentage>
</VariableHandlingCharges>
<International>
<BrokerSelectionOption></BrokerSelectionOption>
</International>
</FDXRateAvailableServicesRequest>
 
Thanks Kenos,

It seems fedex is supposed to send you the Fedex API Direct Manual when you sign up as an automated process. Well....You would swear to God that the manual was going to corrupt your soul, warp your spine and keep the country from winning the war the way they hedge around sending it to you!

I understood the strings well enough, though your post will save me some manual work, but no one at fedex API support could give me even the slightest hint at WHERE to send the request beyond the fact that it went to gatewaybeta.fedex.com and it had to be sent to port 443. I finally wrangled the GatewayDC out of some poor scared slob at tech support today. He delivered it to me in a quavering voice full of stoic insecurity in what he was talking about.

He was actually reading from the elusive manual which should have been part of the welcome package but, under direct orders from God and the president himself, could not share a copy with me without prior written consent from the pope, Moses and Colin Powell.

For Christ sakes you would think this damn thing held the secret to the universe the way they protect it and it SHOULD have been sent anyway according to everyone I spoke to.

When I FINALLY managed to get one of their support people to send it to me, I had this damn thing working in less than 5 minutes but I only did the initial service request. got my meter number, ready to move on....

Thanks to all who responded.

Toga

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top