You can't do it through UPS. They use SOAP/XML for their endpoints with absolutely no client libraries or documentation to support you, but you can use Easypost to connect to UPS today using Java.
package shipments;
import com.easypost.exception.EasyPostException;
import com.easypost.model.Shipment;
import com.easypost.model.Parcel;
import com.easypost.service.EasyPostClient;
import java.util.HashMap;
public class Buy {
public static void main(String[] args) throws EasyPostException {
EasyPostClient client = new EasyPostClient(System.getenv("EASYPOST_API_KEY"));
Parcel parcel = client.parcel.create(new HashMap<string, object>() {
{
put("predefined_package", "Parcel");
put("weight", 28);
}
});
Shipment shipment = client.shipment.create(new HashMap<string, object>() {
{
put("to_address", toAddress);
put("from_address", fromAddress);
put("parcel", parcel);
}
});
client.shipment.buy(shipment.getId(), shipment.lowestRate());
}
}
QALO uses EasyPost's API to automate their returns for an unbeatable customer experience.
With EasyPost's API, Expedited Passports & Visas cut their operational load in half.
Casper sped up their European launch thanks to EasyPost's support of over 30+ European carriers.
Sign up and start shipping in the same day with our Java Library. If you have any questions, or if you want to talk logistics, feel free to reach out to one of our shipping experts.