cancel
Showing results for 
Search instead for 
Did you mean: 

Version API:Major minor versions

itsard
Champ in-the-making
Champ in-the-making
Hi,
When I check a document in  in the alfresco repository through SOAP webservice api, how do I pass the information
if I need to create a major version or a minor version.?
The create version api or the check in api has no parameter for specifying this information.
Can anyone let me know how can this be achieved?
Thanks.
1 REPLY 1

gyro_gearless
Champ in-the-making
Champ in-the-making
Hi,
with some digging in Alfresco's source code, i eventually found the answer:  :shock:

The trick is to pass an additonal "versionType" parameter with value "MAJOR" with the SOAP request. Here is a snippet of PHP-Code, but should easily translate to any programming language:

      $client = AlfWebServiceFactory::getAuthoringService($this->_session->repository->connectionUrl, $this->_session->ticket);
      $result = $client->createVersion(
         array("items" => array("nodes" => $this->__toArray()),
               "comments" => array(
                                  array("name" => "description", "value" => $description),
                                  array("name" => "versionType", "value" => "MAJOR")
                                  ),
               "versionChildren" => false));   

and here is what the SOAP request should look like:

  <SOAP-ENV:Body>
    <ns2:createVersion>
      <ns2:items>
        <ns1:nodes>
          <ns1:store>
            <ns1:scheme>workspace</ns1:scheme>
            <ns1:address>SpacesStore</ns1:address>
          </ns1:store>
          <ns1:uuid>bf3f52bf-a74c-4474-9ccd-fecb22f0563d</ns1:uuid>
        </ns1:nodes>
      </ns2:items>
      <ns2:comments>
        <ns1:name>description</ns1:name>
        <ns1:isMultiValue xsi:nil="true"/>
        <ns1:value>A new major version</ns1:value>
      </ns2:comments>
      <ns2:comments>
        <ns1:name>versionType</ns1:name>
        <ns1:isMultiValue xsi:nil="true"/>
        <ns1:value>MAJOR</ns1:value>
      </ns2:comments>
      <ns2:versionChildren>false</ns2:versionChildren>
    </ns2:createVersion>
  </SOAP-ENV:Body>


HTH
Gyro