easypost-java
easypost-java copied to clipboard
[Bug]: USPS buy Pickup API call throwing error "Invalid name. Please check for any special characters."
Software Version
7.1.0
Language Version
17
Operating System
Ubuntu Linux
What happened?
- Create Pickup Request for USPS.
- From the response object select the respective Carrier and Service name to make buy Pickup api call.
- Getting error as "Invalid name. Please check for any special characters." ...
What was expected?
Expected that Error objects should specify that the error property name for that the API call is failing instead of the generic fallback of "Invalid name. Please check for any special characters."
Sample Code
Map<String, Object> requestPayload = new HashMap<>();
requestPayload.put("carrier", "USPS");
requestPayload.put("service", "NextDay");
client.pickup.buy(pickupId, requestPayload);
Relevant logs
CODE = PICKUP.BUY.FAILED
MESSAGE = Invalid name. Please check for any special characters.
StackTrace:
com.easypost.exception.API.BadRequestError: Invalid name. Please check for any special characters.
at com.easypost.http.Requestor.handleAPIError(Requestor.java:676)
at com.easypost.http.Requestor.httpRequest(Requestor.java:610)
at com.easypost.http.Requestor.request(Requestor.java:504)
at com.easypost.http.Requestor.request(Requestor.java:448)
at com.easypost.service.PickupService.buy(PickupService.java:121)
Hey @k0m09dx, thanks for writing in. Is the carrier
and service
provided above the only thing present in the requestPayload
? What is the pickupId
you are using? Are there any additional pieces of sample code you could share that hasn't been yet that may help us in reproducing this issue?
Hi @Justintime50 I followed the steps mentioned in the Doc .FYR: https://www.easypost.com/docs/api/java#buy-a-pickup. Language: Java(17). you can try the same with below Id Environment: test Pickup Id: pickup_2861e54ae5ba413baa9ce785f4ca634b Shipment Id: shp_9e76a9a04e234b4a8248d6f61da3c55b
What happens if you try with a new shipment that has a corrected address "name" field? It appears there is a 2
in the name field which may be leading to this error with USPS? See Koushik2 Mondal
in the response. Let me know if that works as expected once corrected.
Sorry for the delayed response. the above issue fixed.