Trying to work with QwintryLogistics API, all docs examples in PHP, I don't know PHP at all, coding on Java. In docs needed request looks like this:
<?php
    define('SITE_URL', 'logistics.qwintry.com');
    define('API_KEY', 'YOUR_API_KEY'); //don't forget to set your key!
    $url =  'http://'. SITE_URL .'/api/cost';
    $data = array ( 
        'params' => array(
            'weight' => 5, // in lb
            'delivery_pickup' => 'msk_1', // full list of pickup points can be retrieved from /api/locations-list
            'insurance' => true,
            'items_value' => 500, // declaration items total cost in USD
            'retail_pricing' => true // retail / wholesale pricing?
        ),
     );
    $data_string = http_build_query($data);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '. API_KEY));
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $data_string);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $response = curl_exec($ch);
    curl_close($ch);
    var_dump($response);
coded method in Java:
@Override
public String getCost(double weight, String unitsW, String toPickUp, boolean insurance, double value) throws URISyntaxException, IOException, HttpException {
    String url = BASE_URL + "/api/cost/";
    CloseableHttpClient client = HttpClients.createDefault();
    URIBuilder builder = new URIBuilder(url);
    builder
            .addParameter("weight", String.valueOf(weight))
            .addParameter("delivery_pickup", toPickUp)
            .addParameter("insurance", String.valueOf(insurance))
            .addParameter("items_value", String.valueOf(value))
            .addParameter("retail_pricing", String.valueOf(RETAIL_PRICING));
    HttpUriRequest request = new HttpPost(builder.build());
    request.addHeader("User-Agent", USER_AGENT);
    request.addHeader("Authorization", "Bearer " + API_KEY);
    HttpResponse response = client.execute(request);
    BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    StringBuffer result = new StringBuffer();
    String line = "";
    while ((line = rd.readLine()) != null) {
        result.append(line);
    }
    return result.toString();
}
But constantly getting response:
{"success":false,"errorCode":0,"errorMessage":"params are empty"}
I think problem is in setting parameters for request. Help me please translate structure of parameters of request in Java terms.
 
     
    