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.