UPS Tracking Web Service Not Working

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
ibmiguy
Posts: 2
Joined: Thu Dec 09, 2021 5:04 pm

UPS Tracking Web Service Not Working

Post by ibmiguy »

Hi All,

I can get the request working through Postman but my attempts fail with a 406 code.
I have tried both request types with the same result.

What the heck am I doing wrong?
Working with UPS is a pain!

Dcl-Proc SetHeader;

// ----------------------------------------------------------------------------------
// Input Parameters
// ----------------------------------------------------------------------------------

Dcl-pi *N;
Headers VarChar(1024);
End-pi;

// ----------------------------------------------------------------------------------
// Local Parameters
// ----------------------------------------------------------------------------------

// ----------------------------------------------------------------------------------
// Data Structures
// ----------------------------------------------------------------------------------

// ----------------------------------------------------------------------------------
// Mainline
// ----------------------------------------------------------------------------------

Headers = 'Username: ' + %Trim(UPSUserName) + CRLF +
'Password: ' + %Trim(UPSPassword) + CRLF +
'AccessLicenseNumber: ' + %Trim(APIKey) + CRLF;

End-Proc;

Dcl-S TrackingUrlProd VarChar(100)
Inz('https://onlinetools.ups.com/track/v1/details/');

Request = %Trim(TrackingURLProd) + %Trim(EntTrackNo);

Rc = http_xproc(HTTP_POINT_ADDL_HEADER : %paddr(SetHeader));


Rc = http_url_get( Request : ResponseFile);

// rc = http_req('GET'
// : Request
// : ResponseFile
// : *omit
// : *omit
// : *Omit
// : 'application/json');

// Load Response If No Error
If Rc = 1;
ibmiguy
Posts: 2
Joined: Thu Dec 09, 2021 5:04 pm

Re: UPS Tracking Web Service Not Working

Post by ibmiguy »

I added to the header and it works now.

Content-Type: application/json
Accept: application/json

Thanks!
Post Reply