Hi,
I'm working on a connecting to the Fedex Address Validation API through the Alteryx Download tool and am getting a 401 Unauthorized error message. The same call using the same credentials works successfully in Postman.
The first workflow connects to Fedex's Api Authorization API and successfully gets the bearer token. The token is passed to the second workflow with an address to validate.
For troubleshooting, I'm using the provided Fedex request sample in the payload. I've composed the query field by field, taken the query from a field and tried pasting the payload directly into the Download tool.
The error message implies the issue is with the bearer token, however the token works when used in Postman, and the headers appear to be straight-forward. Only content-type and authorization are required and I've tried both hardcoding the values in as constant and passing the values from fields. The bearer token from Fedex however is 1196 characters long (if that matters).(I've also tried adjusting the authorizations data type and field length, just in case).
Rough version of workflow attached with the current bearer token removed (old one still in formula tool).
Any assistance would be appreciated.
{
"inEffectAsOfTimestamp": "2019-09-06",
"validateAddressControlParameters": {
"includeResolutionTokens": true
},
"addressesToValidate": [
{
"address": {
"streetLines": [
"7372 PARKRIDGE BLVD",
"APT 286",
"2903 sprank"
],
"city": "IRVING",
"stateOrProvinceCode": "TX",
"postalCode": "75063-8659",
"countryCode": "US",
"urbanizationCode": "EXT VISTA BELLA",
"addressVerificationId": "string"
}
}
]
}
API Documentation
API Authorization Documentation | FedEx Developer Portal (WORKING)
Address Validation API Documentation | FedEx Developer Portal (NOT WORKING)
Download Headers
HTTP/1.1 200 Connection Established
Proxy-Agent: Zscaler/6.1
HTTP/1.1 401 Unauthorized
Content-Encoding: gzip
Content-Type: application/json;charset=UTF-8
Content-Length: 186
Server: Layer7-API-Gateway
Date: Mon, 18 Jul 2022 12:47:07 GMT
Connection: close
Vary: Accept-Encoding
Server-Timing: cdn-cache; desc=MISS
Server-Timing: edge; dur=125
Server-Timing: origin; dur=45
Can you try building in the Authorization step as well? It could be that the bearer token has expired and you have it hard coded into your workflow. I believe the standard length of time before expiration is 1 hour and it could be expired.
I have a Blog post that goes over the basics of API calls in Alteryx here: https://community.alteryx.com/t5/Engine-Works/APIs-for-Beginners-Integrate-All-the-Systems/ba-p/8074...
Also, make sure that you have Content-Type capitalized in your Headers. This may seem picky, but APIs often times won't work correctly if you don't have casing exact. Banged my head against the keyboard a few years trying to figure that one out! Authorization may need to be capitalized too, just double check on the casing of all of them.
One additional thought as you work through this - try clicking on the code button on the right side of Postman to see the cURL equivalent. Sometimes there are additional pieces generated in the call that you may see in the code equivalent:
Amanda, did you ever find the solution to this? I was just looking to do the same thing and having the same error. Thanks in advance.