Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Utilizing FedEx Track API to capture Tracking Status results in Status 422 - 'INVALID.INPUT.EXCEPTION', 'message': 'Invalid field value in the input'

$
0
0

I see there are a few questions/answers on this particular error. However, none are in relationship to the FedEx Track API specifically. I'm attempting to iterate a list of tracking numbers through this service to capture their status. I have a developer account, API KEY, Secret KEY, and also have obtained the oAuth Token as needed. When attempting to call the API I'm receiving the following error under status code 422:

Response: {'transactionId': 'b8e70ec3-72b3-41b0-886a-f42f2559adb7', 'errors': [{'code': 'INVALID.INPUT.EXCEPTION', 'message': 'Invalid field value in the input'}]}.

If I remove the token, I'll receive a 400 status error. I believe this tells me I'm using the correct token, and API post method. However, I feel there is something I've missed. I've read through the documentation and believe I'm passing all the appropriate information.

Below is the code I've been running:

authoriztion_key = get_oauth()        url = f"{sandbox_url}/track/v1/trackingnumbers"        payload = {"trackingInfo": [                    {"trackingNumberInfo": {"trackingNumber": f"{tracking_number}"                      }                    }                  ],"includeDetailedScans": 1                }        headers = {'Content-Type': "application/json",'x-locale': "en_US",'Authorization': f'Bearer {authoriztion_key}'        }        print(f"\nEnpoint: {url}")        print(f'\nPayload: {payload}')        print(f'\nHeaders: {headers}')        response = requests.post(url, data=payload, headers=headers)        print(f'\nStatus: {response.status_code}')        print(f'Response: {response.json()}')

If anyone is able to spot the error, let me know.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>