1
votes

I am trying to see whether MarkLogic Java API can be used to create a content database and REST Server? I went through te Java API but I dont see any reference.

Is it possible to create a REST Server through MarkLogic Java API?

I appreciate any links or pointers regarding this.

1
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it. - JFPicard
@JFPicard I want to create the Marklogic Content DB, REST Server using JAVA Client API of marklogic. I don't have any reference to create Content DB and REST Server on the fly using JAVA Client API. Is there any document available for the above stuff. Right now we are using curl to create the above stuff but i want it to be controlled through the java API provided by Marklogic. - Vikram

1 Answers

2
votes

No, that's beyond the scope of the Java Client API. The Java Client API must connect to a REST Server after it's already created. You can, however, use the /rest-apis service on port 8002 via your favorite generic REST client API for Java. To see an example of how to do this with Apache HttpClient, see Bootstrapper.java. You can use it directly like the unit tests setup util TestServerBootstrapper.java does with this code:

Bootstrapper.main(new String[] {
  "-configuser", username, 
  "-configpassword", password, 
  "-confighost", host, 
  "-restserver", "java-unittest", 
  "-restport", ""+port, 
  "-restdb", "java-unittest"});