Page 1 of 2

REST API - PathNotFoundException while deleting via UUID

PostPosted:Thu Oct 06, 2016 12:40 pm
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!

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Fri Oct 07, 2016 7:58 am
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 ?

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Fri Oct 07, 2016 12:14 pm
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.

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Tue Oct 11, 2016 10:27 am
by pavila
It's a known problem. We'll try to fix before releasing the next Community.

Regards.

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Wed Oct 12, 2016 10:13 am
by jllort
We have added the issue for it here http://jira.openkm.com ( OCM-27 you should have an account for watching it ).

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Thu Oct 20, 2016 8:52 am
by openkm_user
Hi,

Thanks for the reply, any idea about when this will be fixed?

How to register in http://jira.openkm.com ?

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Sat Oct 22, 2016 6:23 pm
by jllort
See in main page:
Not a member? To request an account, please contact your JIRA administrators. Follow the link http://jira.openkm.com/secure/ContactAd ... fault.jspa and ask for an account

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Mon Oct 24, 2016 1:11 pm
by openkm_user
Requested, thanks again!

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Wed Dec 14, 2016 4:33 pm
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.

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Sat Dec 17, 2016 1:27 pm
by openkm_user
Thanks, we will try and let you know.

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Tue Dec 20, 2016 12:51 pm
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()?

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Wed Dec 21, 2016 5:00 pm
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 )

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Mon Dec 26, 2016 2:52 pm
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?

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Tue Dec 27, 2016 2:49 pm
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.

Re: REST API - PathNotFoundException while deleting via UUID

PostPosted:Wed Jan 04, 2017 1:00 pm
by openkm_user
Thanks! The login method you mentioned worked, there is no login REST method, so we created it.