Property samples

Basics

On most methods you'll see parameter named "nodeId". The value of this parameter can be a valid document, folder, mail or record UUID or path.

Example of nodeId:

  • Using UUID -> "adabdb0f-7ff8-4832-9e43-8bc96fc1c9a5";
  • Using path -> "/okm:root/SDK4PHP/logo.png"

Methods

addCategory 

Description:

MethodReturn valuesDescription

addCategory($nodeId, $catId)

void

Sets a relation between a category and a node.

Parameters:

$nodeId string type is the uuid or path of the document, folder, mail or record

$catId string type is the text

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }

    public function testAddCategory() {
        try {
            $this->ws->addCategory("/okm:root/SDK4PHP/logo.png", "/okm:categories/test");
            echo 'add category';
        } catch (Exception $e) {
            var_dump($e);
        }
    }    

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testRemoveCategory();

?>

removeCategory 

Description:

MethodReturn valuesDescription

removeCategory($nodeId, $catId)

void

Removes a relation between a category and a node.

Parameters:

$nodeId string type is the uuid or path of the document, folder, mail or record

$catId string type is the text

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }
    
    public function testRemoveCategory() {
        try {
            $this->ws->removeCategory("/okm:root/SDK4PHP/logo.png", "/okm:categories/test");
            echo 'remove category';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testRemoveCategory();

?>

addKeyword 

Description:

MethodReturn valuesDescription

addKeyword($nodeId, $keyword)

void

Adds a keyword and a node.

Parameters:

$nodeId string type is the uuid or path of the document, folder, mail or record

$keyword string type is the keyword

The keyword should be a single word without spaces, formats allowed:

  • "test"
  • "two_words" ( the character "_" is used for the junction ).

Also we suggest you to add keyword in  lower case format, because OpenKM is case sensitive.

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }
    
    public function testAddKeyword() {
        try {
            $this->ws->addKeyword("/okm:root/SDK4PHP/logo.png", "test");
            echo 'add keyword';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testAddKeyword();

?>

removeKeyword 

Description:

MethodReturn valuesDescription

removeKeyword($nodeId, $keyword)

void

Removes a keyword from a node.

Parameters:

$nodeId string type is the uuid or path of the document, folder, mail or record

$keyword string type is the keyword

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }

    public function testRemoveKeyword() {
        try {
            $this->ws->removeKeyword("/okm:root/SDK4PHP/logo.png", "test");
            echo 'remove keyword';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testRemoveKeyword();

?>

setEncryption 

Description:

MethodReturn valuesDescription

setEncryption($nodeId, $cipherName)

void

Marks a document as an encrypted binary data into the repository

Parameters:

$nodeId string type is the uuid or path of the document

$chipherName string type is the cipher name saves information about the encryption mechanism.

This method does not perform any kind of encryption, it simply marks into the database that a document is encrypted.

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }    

    public function testSetEncryption() {
        try {
            $this->ws->setEncryption("/okm:root/SDK4PHP/logo.png", "pharase");
            echo 'Set Encryption';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testSetEncryption();
?>

unsetEncryption 

Description:

MethodReturn valuesDescription

unsetEncryption($nodeId)

void

Marks a document as a normal binary data into repository.

Parameters:

$nodeId string type is the uuid or path of the document

This method does not perform any kind of uncryption, it simply marks into the database that a document has been uncrypted.

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }

    public function testUnsetEncryption() {
        try {
            $this->ws->unsetEncryption("/okm:root/SDK4PHP/logo.png");
            echo 'unset Encryption';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testUnsetEncryption();
?>

setSigned 

Description:

MethodReturn valuesDescription

setSigned($nodeId, $signed)

void

Marks a document as signed or unsigned binary data into the repository

Parameters:

$nodeId string type is the uuid or path of the document

$signed bool type

This method does not perform any kind of digital signature process, it simply marks into the database that a document is signed.

Example:

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExampleProperty {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }
    
    public function testSetSigned() {
        try {
            $this->ws->setSigned("/okm:root/SDK4PHP/logo.png",true);
            echo 'set Signed';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload
$exampleProperty = new ExampleProperty();
$exampleProperty->testSetSigned();
?>