RapTor
RapTor

Reputation: 27

Rest API query on Db created through Java app in Marklogic

I have done a JSONDocMgr.write(docId, handle); in my java application. The json data is loaded from a file. I can see my document in http://localhost:8000/qconsole/, but the case is that I need to use REST services to query the DB. The docId is /books/text.json, when I try to do a GET using postman http://localhost:8000/books/search?q=harry I'm getting Page Not Found. Can someone please help me on this.

Upvotes: 1

Views: 78

Answers (1)

Sam Mefford
Sam Mefford

Reputation: 2475

To get your document via REST see /v1/documents. For example:

curl -i --digest --user myuser:mypwd -X GET \
  'http://localhost:8000/v1/documents?uri=/books/text.json'

To search documents via REST see /v1/search. For example:

curl -i --digest --user myuser:mypwd -X GET \
  'http://localhost:8000/v1/search?q=harry'

Make sure the port and username you use for REST matches the port and username you use in Java.

Upvotes: 1

Related Questions