2017-03-01 5 views
0

우편 번호 만 제공하여 사용자 위치에서 창고 위치로 운송 요금을 받으려고합니다. 스칼라로 구현해야하므로 Java API를 사용하려고합니다.Easypost in scala

curl -X POST https://api.easypost.com/v2/shipments \ 
    -u <Easypost api key>: \ 
    -d 'shipment[to_address][name]=Dr. Steve Brule' \ 
    -d 'shipment[to_address][street1]=179 N Harbor Dr' \ 
    -d 'shipment[to_address][city]=Redondo Beach' \ 
    -d 'shipment[to_address][state]=CA' \ 
    -d 'shipment[to_address][zip]=90277' \ 
    -d 'shipment[to_address][country]=US' \ 
    -d 'shipment[to_address][phone]=8573875756' \ 
    -d 'shipment[to_address][email][email protected]' \ 
    -d 'shipment[from_address][name]=EasyPost' \ 
    -d 'shipment[from_address][street1]=417 Montgomery Street' \ 
    -d 'shipment[from_address][street2]=5th Floor' \ 
    -d 'shipment[from_address][city]=San Francisco' \ 
    -d 'shipment[from_address][state]=CA' \ 
    -d 'shipment[from_address][zip]=94104' \ 
    -d 'shipment[from_address][country]=US' \ 
    -d 'shipment[from_address][phone]=4153334445' \ 
    -d 'shipment[from_address][email][email protected]' \ 
    -d 'shipment[parcel][length]=20.2' \ 
    -d 'shipment[parcel][width]=10.9' \ 
    -d 'shipment[parcel][height]=5' \ 
    -d 'shipment[parcel][weight]=65.9' 

그것은에 제시되어있다 :

com.easypost.exception.EasyPostException: Unable to find lowest rate matching required criteria. 

내가 심지어처럼 곱슬 곱슬 명령을 사용하여 시도 :

var fromAddressMap:HashMap[String,Object]=new util.HashMap[String,Object] 
fromAddressMap.put("zip",warehouse_zip) 
var toAddressMap:HashMap[String,Object]=new util.HashMap[String,Object] 
toAddressMap.put("zip",user_zip) 
var parcelMap:HashMap[String,Object]=new util.HashMap[String,Object] 
parcelMap.put("weight", "22") 
parcelMap.put("height", "12") 
parcelMap.put("width", "8") 
parcelMap.put("length", "19") 
val fromAddress:Address=Address.create(fromAddressMap) 
val toAddress:Address=Address.create(toAddressMap) 
val parcel:Parcel = Parcel.create(parcelMap) 
val shipmentMap:HashMap[String,Object]=new util.HashMap[String,Object] 
shipmentMap.put("to_address",toAddress) 
shipmentMap.put("from_address",fromAddress) 
shipmentMap.put("parcel", parcel) 
val buyCarriers= new util.ArrayList[String] 
buyCarriers.add("USPS") 
val buyServices= new util.ArrayList[String] 
buyServices.add("PriorityMailInternational") 
var shipment = Shipment.create(shipmentMap) 
shipment = shipment.buy(shipment.lowestRate(buyCarriers, buyServices)) 
println("Price is "+shipment.prettyPrint()) 

내가 얻고 모든 예외가 말하는 - 아래는 내가 사용하고있는 코드는 그들의 예. 하지만 오류가 발생합니다 :

curl: (77) error setting certificate verify locations: 
    CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 

어떻게하면 좋을까요?

답변