Reputation: 966
I am using Alfresco. I know how to see installed Alfresco vesrion number, but I need to get this version number programmatically, for example via rest API or some http request. Is it possible to do that?
Upvotes: 2
Views: 1564
Reputation: 60213
You can use the "Browser Binding" API of the CMIS protocol.
In particular, read this property:
productVersion
Reference: http://docs.oasis-open.org/cmis/CMIS/v1.1/cs01/CMIS-v1.1-cs01.html#x1-1660002 paragraph 2.2.2.2.2
Advantage over the other methods: CMIS is a standard so this operation will always be available, unlike the Share webscripts which might change. Also, your code will be compatible with any other CMIS implementation.
Here is an example of how CMIS via JavaScript works.
Upvotes: 1
Reputation: 324
The REST API that Share uses to get the data from the repo is (e.g.):
http://localhost:8081/share/proxy/alfresco/api/server
This returns:
{
data: {
edition: "Enterprise",
version: "5.0.0",
schema: "8002"
}
}
That webscript is this one: https://github.com/Alfresco/community-edition/blob/master/projects/remote-api/config/alfresco/templates/webscripts/org/alfresco/repository/server.get.desc.xml
Upvotes: 4
Reputation: 534
In JavaScript code you can use the server object:
server.version
server.versionMajor
server.versionMinor
server.versionRevision
server.edition
In Java you can use the DescriptorService, for example:
serviceRegistry.getDescriptorService().getCurrentRepositoryDescriptor().getVersion()
Upvotes: 2