AnsweredAssumed Answered

Import leads with Rest API

Question asked by d9e7a7f1c2c2f90f5d41f1b826a6afc1b863e57c on Aug 6, 2014
Latest reply on Jul 14, 2015 by Takehiro Monday
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!