• REST API - PathNotFoundException while deleting via UUID

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #42358  by openkm_user
 
Hi,

While deleting a document using UUID REST API returns PathNotFoundException pointing Trash. But when we do it directly in OpenKM application we are able to delete and it automatically creates a {username} folder in Trash, after this is done REST delete works.

If it is a fresh delete ({username} folder not yet created in Trash) directly through API it returns above error.

Please advice!
 #42363  by jllort
 
Really when you login in openkm the trash folder is automatically created ( this is an old bug what I thought was yet solved in community version ). Can you tell me which OpenKM version are you using ?
 #42370  by openkm_user
 
We are using OpenKM Community Version: 6.3.1 (build: 8235). We do everything through REST API, create a user (simulatneously) in OpenKM when a user is created in our application, login (again REST API) to OpenKM when the user performs an action (like search for document) in our application. Problem is while logging into OpenKM using REST API it isn't creating the folder in Trash automatically, but the same works fine when done directly in OpenKM frontend.
 #42719  by jllort
 
When users only accessing from ws, the first time any user access to the system must call the ws.login() method what creates the /okm:trash/userId etc... folders. It must be called only one time, later is not necessary call it again.
 #42802  by openkm_user
 
Is this fixed in Community version 6.3.3? Is it available for public? Can you please let me know how to use ws.login()?
 #42820  by jllort
 
You must be sure at least one time ( at the begining ) this user has called the ws.login method() it will creates all missing folders. I do not know what you are doing across the ws and what is your logic and the language used for connecting ( are you using one of our sdk's ? ).

Finally, yes this method is available from community release at Auth rest service ( http://some_ip/OpenKM/services/rest/auth?_wadl )
 #42866  by openkm_user
 
We are using PHP and the SDK from here,
https://wiki.openkm.com/index.php/SDK_for_PHP_1.0.1

For every REST call we login and perform the necessary action.
Code: Select all
class TestAuth {
 
		const HOST = "http://localhost:8080/OpenKM/";
		const USER = "okmAdmin";
		const PASSWORD = "admin";
		const TEST_DOC_PATH = "/okm:root/OpenKM/architecture.html";
		const TEST_DOC_UUID = 'e0856a93-3b25-4726-88fc-632dec7c6ab0';
 
		private $ws;
 
		public function __construct() {
		$this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
}
Above function __construct() function will do my authentication, so how to use ws.login() function?
 #42875  by jllort
 
Something what must be explained with more detail .. but not easy. I will try. We'll basically the Rest Webservices are all authenticated, but there's a method named login() what exactly has not relation with authentication process ( the name is causing confusion to you ). This method - login() - emulates some core steps like checking user paths ( /okm:/trash/userId folder etc... and create them when are missing ). I'm with you the name of the method is not helping about what really happens internally, is quite difficult explaining the distinct behaviour when you are using the API from REST.

When accessing from UI, the OpenKM user session always make at least one call to internal login() method, but from REST API this method is never called ( if you do not call manually ). When a user operates across the REST if he never has been logged from the OpenKM UI, then never has been executed login(), that means some user folders are missing.

Probably login() method should be refactored in favour of initUserRepository() or similar name, because that's what really happens.

Hope this explanation will give some light to you. The idea behing it, is that at least one time, the users should call login() method for creating special user folders. As I said, probably the name is lying us about what's really happening when executing it.
 #42931  by openkm_user
 
Thanks! The login method you mentioned worked, there is no login REST method, so we created it.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.