How create Nuxeo document using csv file and java rest api

Hi, I am trying to develop a java program (java client + rest API) that allows to create nuxeo documents by using as input a csv file.
I followed the tutorial of nuxeo “https://doc.nuxeo.com/nxdoc/java-client/#operation-api” and I created a document via the request put. this is my code :

package up1.nuxeo.fileMaker;

import org.nuxeo.client.NuxeoClient;

import org.nuxeo.client.objects.Document;

import okhttp3.Response;

import static org.junit.Assert.assertEquals;

import static org.junit.Assert.assertNotNull;

import java.io.IOException;

public class FileMakerTest {

public static void main(String[] args) throws IOException {
String url = “http://localhost:8080/nuxeo”;

    NuxeoClient nuxeoClient = new NuxeoClient.Builder()
          .url(url)
           .authentication("Administrator", "Administrator")
           .connect();              
    Document root = nuxeoClient.repository().fetchDocumentRoot();
System.out.println(root.getId());       

Response response = nuxeoClient.put(“http://localhost:8080/nuxeo/api/v1/id/5fd2ab97-a8ae-4fb5-a67c-c4c13c0fb05a/“,

            "{\"entity-type\": \"document\",\"properties\": {\"dc:title\": \"new title test\"}}");
        assertEquals(true, response.isSuccessful());
String json = response.body().string();
Document document = (Document) nuxeoClient.getConverterFactory().readJSON(json, Document.class);

}

}

someone tell me how to create multiple nuxeo documents with a single post request from a csv file ?

best regards

0 votes

0 answers

2028 views

ANSWER