Re: How to find out the Document Path from the given document node id?
are you working with the alfresco-js-api library, the new REST services or in the web-script context (I'm asking because you are talking about an id and not about a noderef like workspace://SpacesStore... that you would use if in Web-Script or serverside JS context)
JS-Api has functions called node.getNodeInfo(...) and core.nodesApi.getNode(...) returning a nodeEntry (nodeFull) on GET method, which also returns the node properties
- not shure if there is a property for displayPath, but it should be. Look for the documentation in the alfresco github repository.
If not, you could write a web-script that uses exactly the approach Hardik1512 described. This script could then also be called by the alfresco js api method "core.webscriptApi.executeWebScript"