I have a rest instance created on 8002 port and it is using default details database etc.
I have another database and I want to see all documents available there and also I want to get specific document.
http://localhost:8002/LATEST/rest-apis/ - work fine and show database, port etc details but when I add /search?database=nuxeo I got error 400
How can I achieve this
The instance on port 8002 is part of management API..
For MarkLogic 8 and beyond, the idea of needing your own rest API is not needed (the HTTP rewriter takes care of this) and you can pass a parameter to set the database.
For your need above, I would be hitting the search endpoint as described here with examples: https://docs.marklogic.com/REST/GET/v1/search
You can then tune these results to give you just the URIS(other interesting endpoints are available as well such as the values endpoint) or transform the data in other ways.
For getting a single document, then you would use the document get endpoint (look in the same REST API docs for that one)