We are trying to use the Shippo API to print shipping label and cannot seem to get it to work. The data used in the code here is directly from the Shippo website.
We are using Swift, Alamofire, and SwiftyJSON with this Swift code from our ios App, and getting this error result:
{
"detail" : "Shippo API could not process your request. Request ID: 8af7a4c883cd453bb492ad2782bd54d3"
}
We have searched the Shippo site, stackoverflow and Google but cannot find any reference to this error.
Here is the Swift code:
func shippoRequest() {
var headers: HTTPHeaders = [
"content-type": "application/json"
]
let credentials = "shippo_test_318550b6ebde57479ef555ae7f80e660c23ee6c6"
headers["Authorization"] = "ShippoToken \(credentials)"
let parameters: [String: Any] = [
"address_from": [
[
"name" : "Shippy Shipper",
"company": "Our Shippo App",
"street1" : "101 Lafayette Road",
"street2" : "",
"city" : "Rye",
"state" : "NH",
"zip" : "03870",
"phone" : "8443872777",
"country" : "US",
"email" : "cuzineed1@yahoo.com"
]
],
"address_to": [
[
"name": "Mrs. Hippo",
"street1": "965 Mission St.",
"city": "San Francisco",
"state": "CA",
"zip": "94103",
"country": "US",
"phone": "0987654321",
"email": "support@goshippo.com"
]
],
"async": false,
"parcels": [
[
"length": "5",
"width": "5",
"height": "5",
"distance_unit": "in",
"weight": "2",
"mass_unit": "lb"
]
]
]
let url = "https://api.goshippo.com/shipments"
Alamofire.request(url, method: .post, parameters: parameters , encoding: JSONEncoding.default, headers: headers)
.responseJSON { (response) in
switch response.result {
case .success(let value):
let swiftyJson = JSON(value)
print ("return as JSON using swiftyJson is: \(swiftyJson)")
case .failure(let error):
print ("error: \(error)")
}
}
}
We have tried many different address, both to and from and even used the same data on the shippo website using there test link and it does work.
If Shippo is returning this error we were hoping someone would have seen it before, or Shippo should be able to explain what invalid data generates this error.
Any help would be greatly appreciated.
Thank you