Page 1 of 1

UPS api

Posted: Mon Sep 17, 2012 11:22 pm
by Alex B

Hello,

I am in need of assistance with integrating the UPS API into a REST service. Initially I fiddled around with the Request Parameters to where I got a successful test result but I get a hard 10002 error from UPS that basically states: "The XML document is well formed but the document is not valid" - this is when I contacted UPS Tech Support and they told me that I was missing some request parameters. I updated the request parameters as specified and now I can't even get a successful test! I will say that I wasn't sure if was supposed to include the ?xml version="1.0"? into the request parameters. I tried it without that and wasn't any more successful.

How the UPS API works is that I have to get authorization from the server before I can request anything. I'm not sure if the failure is in the authorization or in the body of the request. When I use my login credentials for UPS, it works just fine.

I've included screen shots of the REST service.

Image Image Image

The last part of the test response says:

Error message:
POST https://wwwcie.ups.com/ups.app/xml/Track returned a response status of 400 Bad Request

I'm not sure what I'm doing wrong. Any help, advice or tips would be greatly. sinotwappreciated!


UPS api

Posted: Tue Sep 18, 2012 12:16 am
by maxkatz

Do you have an example of a correct request (with all its parameters) somewhere? Maybe UPS has one? It's just difficult for me to tell you what to change without knowing what's a correct request is.


UPS api

Posted: Tue Sep 18, 2012 2:30 am
by Alex B

Hello Max,

Thank you for responding to my inquiry. According to UPS technical support, this is what the correct request should be:

code
<?xml version="1&#46;0"?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber> xxxxxxxxxxxxxx<&#47;AccessLicenseNumber>
<UserId>xxxxxxxxxx<&#47;UserId>
<Password>xxxxxxxx<&#47;Password>
<&#47;AccessRequest>

<?xml version="1&#46;0" ?>
<TrackRequest>
<Request>
<TransactionReference>
<CustomerContext>guidlikesubstance<&#47;CustomerContext>
<&#47;TransactionReference>
<RequestAction>Track<&#47;RequestAction>
<&#47;Request>
<TrackingNumber> 1Z12345E0291980793<&#47;TrackingNumber>
<&#47;TrackRequest>
/code

Using that, I believe I have laid out the request correctly in the RESTservice - but it still doesn't work.


UPS api

Posted: Tue Sep 18, 2012 2:49 am
by maxkatz

Aren't these two different requests? One looks like to sign in and the second is to invoke the API?


UPS api

Posted: Tue Sep 18, 2012 2:54 am
by Alex B

So I need to create two different RESTservices for the same API? If so, that just confuses me more and makes this 100x more complicated. But yes, the first part is to sign in and the second to invoke. If you look at the request parameters in my screenshot for the RESTservice, you will see I've included the sign in request in the header and the secondary request as the body.


UPS api

Posted: Tue Sep 18, 2012 3:43 am
by maxkatz

Most services work like that. You first login (authenticate), get a key back and then invoke the service with that key. It's up to the API provider to define how their services work.

What is the URL to which you make the request?


UPS api

Posted: Tue Sep 18, 2012 4:19 am
by Alex B

For some reason I can't post a comment to your latest one.

Well, looks like today I learned something new.

Hmm, when I try testing the connection just with the login - I get the "test successful" but also the hard 10002 error. I'm assuming the key should be in the response parameters?

This is the URL:

https://wwwcie.ups.com/ups.app/xml/Track


UPS api

Posted: Tue Sep 18, 2012 2:10 pm
by maxkatz

I guess so.. the key should be in the response. What is the username/password? If it's not a test account, you can send the info to a href="mailto:support@tiggzi.com" rel="nofollow"support@tiggzi.com/a.

Do you have a link to service docs?