FedEx Address Validation API is returning encoded characters and a 400 bad request error. Here is my request body with the secret key blocked out for obvious reasons:
POST /address/v1/addresses/resolve HTTP/1.1
Content-Type: application/json
x-customer-transaction-id:
x-locale: en_US
authorization: Bearer {my secret key}
{
"addressesToValidate": [
{
"address":{
"streetLines":[
"1234 Example Rd.",
""
],
"city":"Morris",
"stateOrProvinceCode":"AL",
"postalCode":"35116",
"countryCode":"US"
}
}]
}
This is what the encoded response looks like:
HTTP/1.1 400 BadRequest
Content-Type: application/json;charset=UTF-8
Content-Encoding: gzip
Connection: close
Server-Timing: cdn-cache; desc=MISS,edge; dur=115,origin; dur=62
Content-Length: 175
Date: Tue, 28 Jun 2022 18:47:56 GMT
Server: Layer7-API-Gateway
�ʱ�0�_��l�a�Ƞ���p�6�6�@B�������;2�d��� �)�$�4�B%b�L�3
W"�%�N�L��9�<���U9n7��,���REY����{j�Z�=��í�A��Z�8�L���J�Lvp��=���M@
i������ϱ
Here is the API documentation for reference: https://developer.fedex.com/api/en-us/catalog/address-validation/v1/docs.html#operation/Validate Address
CodePudding user response:
The answer was looking up how to decompress gzip in the language I was using. With Outsystems, I downloaded a forge component called gzip that compresses and decompresses binary to and from plaintext.