Page 1 of 1

OpenKM 6.3 WS - How to get the VersionID of a Version

PostPosted:Thu Aug 07, 2014 5:43 pm
by rhomeson
Hello,
I am using the webservices for OpenKM 6.3. Many of the calls in OKMDocument have a "versionId" as an argument. One would expect this. I see the Document has a "uuid" which I believe identifies the overall Document, not the VersionId, since a Document could have many versions. It would seem natural that the versionId would be contained within the Version class, but it is not.
My question is simple. How do I obtain the versionId for a particular version of a Document?

For example, in OKMDocument there is a method:
public DataHandler getContentByVersion(String token, String docPath, String versionId)

Seems reasonable. I can get the token and construct the docPath without any difficulty. However there is nothing in the API, or in the code, that indicates how I am to obtain the versionId.
thanks

Re: OpenKM 6.3 WS - How to get the VersionID of a Version

PostPosted:Fri Aug 08, 2014 6:04 pm
by jllort
The document rest service has a method what returns version history.
Code: Select all
@GET
@Path("/getVersionHistory")
public VersionList getVersionHistory(@QueryParam("docId") String docId)
What openkm version are you using ? and are you using some of our sdk ?

Re: OpenKM 6.3 WS - How to get the VersionID of a Version

PostPosted:Mon Aug 11, 2014 3:36 pm
by rhomeson
Thanks for your reply. I am using the 6.3 web services. Specifically the SOAP interface. I saw the OKMDocument getVersionHistory() call, which returns a List of Versions.
Code: Select all
   public List<Version> getVersionHistory(
        @WebParam(name = "token", targetNamespace = "")
        String token,
        @WebParam(name = "docPath", targetNamespace = "")
        String docPath)
        throws DatabaseException_Exception, PathNotFoundException_Exception, RepositoryException_Exception

The problem, as I mentioned in an earlier post, is that the Version class does have a versionId. Here are the attributes in the Version class:
Code: Select all
    protected boolean actual;
    protected String author;
    protected String checksum;
    protected String comment;
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar created;
    protected String name;
    protected long size;
It could well be that one of these attributes is indeed the versionId. The checksum? The name? Nothing in the documentation or the API describes this. I would have thought that in the Version class, there would be an attribute:
Code: Select all
   protected String versionId;
but there isn't.

Re: OpenKM 6.3 WS - How to get the VersionID of a Version

PostPosted:Thu Aug 14, 2014 8:55 am
by jllort
The version id is the value of var called "name". And yes, the name of the var can generate some confusion us we've interpretated as "the name of the version". There you must got values like 1.0, 1.1 etc...

Re: OpenKM 6.3 WS - How to get the VersionID of a Version

PostPosted:Mon Mar 30, 2015 7:09 am
by anosh123
I have the same question about obtaining the versionId from the client API. I am using 6.2. It would seem natural that the versionId would be kept with the Version class. However, based upon the reply, I looked at Document (returned from getProperties in the OKMDocument class). The Document class has no attribute called versionId either. It does have a Version (actualVersion), but there is no versionId there either. I am sure I am missing something obvious.

Re: OpenKM 6.3 WS - How to get the VersionID of a Version

PostPosted:Tue Mar 31, 2015 6:56 am
by jllort
Into version you got the var called name. This is the id you're looking for.