× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi All,

I need help using SQL HTTP_POST.I am trying to create a shipping label in the Pitney Bowes Sandbox.I can successfully use HTTP_POST to create an authorization token that I need to create the shipping label.However, when I use HTTP_POST to create the shipping label I get an error telling me the access token is invalid.

I can take all the same information and plug it into Postman and it works.Pitney Bowes support tells me that what I am sending is formatted properly and they don’t know what the problem is. I’ve tried to follow the examples I found online.What am I doing wrong or not doing?

If I use HTTP_POST_VERBOSE this is what I get in the Response Header and Response Message.

{"HTTP_STATUS_CODE"="401","Date"="Fri, 14 Jan 2022 13:10:23 GMT","Content-Type"="application/json","Content-Length"="87","Connection"="keep-alive","WWW-Authenticate"="Invalid Access Token","Cache-Control"="no-store,no-cache,max-age=0","Pragma"="no-cache","Strict-Transport-Security"="max-age=10886400; includeSubDomains","CF-Cache-Status"="DYNAMIC","Expect-CT"="max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"","Server"="cloudflare","CF-RAY"="6cd71aaaa9c40fd4-ATL"}

{"errors":[{"errorCode":"PB-APIM-ERR-1002","errorDescription":"Invalid Access Token"}]}

Here is the SQL statement.I am running from ACS Run SQL Scripts.

SELECT

QSYS2.HTTP_POST('https://shipping-api-sandbox.pitneybowes.com/shippingservices/v1/shipments',

'{"fromAddress":{"company":"FC&A","name":"FC&A","phone":"","email":"","residential":"","addressLines":["103 CLOVER GREEN"],"cityTown":"PEACHTREE CITY","stateProvince":"GA","postalCode":"30269","countryCode":"US"},"toAddress":{"company":"","name":"JOHN SMITH","phone":"","email":"","residential":"","addressLines":["PO BOX 1",""],"cityTown":"BONIFAY","stateProvince":"NY","postalCode":"00000","countryCode":"US"},"parcel":{"weight":{"weight":"30","unitOfMeasurement":"OZ"},"dimension":{"length":"10","height":"3","width":"8","unitOfMeasurement":"IN"}},"rates":[{"carrier":"PBPRESORT","serviceId":"BPM","parcelType":"PKG"}],"documents":[{"type":"SHIPPING_LABEL","contentType":"URL","size":"DOC_4X6","fileFormat":"PDF"}],"references":[{"name":"Customer#","value":"70629"},{"name":"Order#","value":"152397"}],"shipmentOptions":[{"name":"SHIPPER_ID","value":"9999999999"},{"name":"PERMIT_NUMBER","value":"PBPS"},{"name":"NON_DELIVERY_OPTION","value":"ChangeServiceRequested"}]}',

'{"header": "Authorization: Bearer Aaaaaaaaaaaaaaaaaaaaaaaa",

"header": "Content-Type: application/json",

"header": "X-PB-TransactionId: a00256870000157440000901",

"header": "X-PB-ShipmentGroupId: 1111",

"header": "X-PB-Integrator-CarrierId: 99999999",

"header": "X-PB-UnifiedErrorStructure: true",

"sslTolerate":"true"}')

from sysibm.sysdummy1;

Thanks for your help.

Regards,

Bobby

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.