4 Replies Latest reply on Jul 14, 2015 3:39 AM by Takehiro Monday

    Import leads with Rest API

      Does anyone have a working java example to import leads through the Rest API? I always get the following error

           [{"code":"610","message":"Requested resource not found"}]

      with the code

           CloseableHttpClient httpclient = HttpClients.createDefault();
           String targetUrl = REST_ENDPOINT + "/bulk/v1/leads.json?access_token="+token;
                       HttpPost httpPost = new HttpPost(targetUrl);
                       FileBody bin = new FileBody(new File("/myfiles/test_data.csv"));
                       HttpEntity reqEntity = MultipartEntityBuilder.create()
                          .addTextBody("listId", "1234")
                          .addTextBody("format", "csv")
                           .addPart("file", bin)
                       CloseableHttpResponse response2 = httpclient.execute(httpPost);

           Thank you!