Difference between revisions of "Csharp webservice dll"

From OpenKM Documentation
Jump to: navigation, search
(Controlling exceptions)
Line 46: Line 46:
  
 
}
 
}
 +
</source>
 +
 +
== Available methods ==
 +
<source lang="csharp">
 +
{{Warning|OKMWebservice library methods are still not finished, this is a list of actuals.}}
 +
 +
void refreshConfiguration(String host, String userName, String password);
 +
// Auth
 +
String login();
 +
void logout(String token);
 +
Dictionary<String, int> getGrantedRoles(String nodePath);
 +
Dictionary<String, int> getGrantedRoles(String token, String nodePath);
 +
Dictionary<String, int> getGrantedUsers(String nodePath);
 +
Dictionary<String, int> getGrantedUsers(String token, String nodePath);
 +
String[] getRoles(String nodePath);
 +
String[] getRoles(String token, String nodePath);
 +
String[] getUsers(String nodePath);
 +
String[] getUsers(String token, String nodePath);
 +
void grantRole(String nodePath, String role, int permission, bool recursive);
 +
void grantRole(String token, String nodePath, String role, int permission, bool recursive);
 +
void grantUser(String nodePath, String user, int permission, bool recursive);
 +
void grantUser(String token, String nodePath, String user, int permission, bool recursive);
 +
void revokeRole(String nodePath, String role, int permission, bool recursive);
 +
void revokeRole(String token, String nodePath, String role, int permission, bool recursive);
 +
void revokeUser(String nodePath, String user, int permission, bool recursive);
 +
void revokeUser(String token, String nodePath, String user, int permission, bool recursive);
 +
String[] getRolesByUser(String nodePath, String user);
 +
String[] getRolesByUser(String token, String nodePath, String user);
 +
String[] getUsersByRole(String nodePath, String role);
 +
String[] getUsersByRole(String token, String nodePath, String role);
 +
String getMail(String nodePath, String user);
 +
String getMail(String token, String nodePath, String user);
 +
String getName(String nodePath, String user);
 +
String getName(String token, String nodePath, String user);
 +
// Repository
 +
OKMFolderBean getTemplatesFolder();
 +
OKMFolderBean getTemplatesFolder(String token);
 +
OKMFolderBean getPersonalFolder();
 +
OKMFolderBean getPersonalFolder(String token);
 +
OKMFolderBean getRootFolder();
 +
OKMFolderBean getRootFolder(String token);
 +
// Document
 +
void create(String docPath, byte[] data);
 +
void create(String token, String docPath, byte[] data);
 +
void checkout(String docPath);
 +
void checkout(String token, String docPath);
 +
void cancelCheckout(String docPath);
 +
void cancelCheckout(String token, String docPath);
 +
void checkin(String docPath, byte[] data, String comment);
 +
void checkin(String token, String docPath, byte[] data, String comment);
 +
bool documentExists(String docPath);
 +
bool documentExists(String token, String docPath);
 +
// Folder
 +
OKMFolderBean[] getChildren(String fldPath);
 +
OKMFolderBean[] getChildren(String token, String fldPath);
 +
OKMQueryResultBean[] find(OKMQueryParamsBean queryParams);
 +
OKMQueryResultBean[] find(String token, OKMQueryParamsBean queryParams);
 +
void create(OKMFolderBean folderBean);
 +
void create(String token, OKMFolderBean folderBean);
 +
void rename(String fldPath, String newName);
 +
void rename(String token, String fldPath, String newName);
 +
void delete(String fldPath);
 +
void delete(String token, String fldPath);
 +
// PropertyGroup
 +
void addGroup(String nodePath, String grpName);
 +
void addGroup(String token, String nodePath, String grpName);
 +
void setPropertiesSimple(String nodePath, String grpName, Dictionary<String, String> propertiesMap);
 +
void setPropertiesSimple(String token, String nodePath, String grpName, Dictionary<String, String> propertiesMap);
 
</source>
 
</source>
  
  
 
[[Category: Extension Guide]]
 
[[Category: Extension Guide]]

Revision as of 12:16, 23 September 2013


Nota clasica.png Dll have been compiled for net 2.0 that should ensure go with any upper .net version

Download File:OKMWebservice.zip

Available api:

  • Webservices for OpenKM Professional 6.4
  • Webservices for OpenKM Professional 6.2
  • Webservices for OpenKM Community 6.0+

Understanding the basics

For all webservices methods are available two methods one with token and other without it. For example to get granted roles of some node path can be used:

Dictionary<String, int> getGrantedRoles(String nodePath);
Dictionary<String, int> getGrantedRoles(String token, String nodePath);

First case getGrantedRoles(nodePath) internally controls login and logout actions for you and is not needed a token.

On second getGrantedRoles(token, nodePath) is necessary provide a token. That means you take control of login and logout actions in your source code.

Example

String host = "http://localhost:8080";
String user = "okmAdmin";
String password = "admin";

int serverVersion = OKMWebServiceFactory.PROFESSIONAL_6_4;
OKMWebservice webservice= null;
if (serverVersion == OKMWebServiceFactory.PROFESSIONAL_6_4)
{
	webservice= OKMWebServiceFactory.getInstance(host, user, password, OKMWebServiceFactory.PROFESSIONAL_6_4);
}
else
{
	webservice= OKMWebServiceFactory.getInstance(host, user, password, OKMWebServiceFactory.PROFESSIONAL_6_2);
}

Controlling exceptions

OKMWebservice dll will throw OKMWebserviceException if happens some error. Is good practice take control in your source code.

try {
  webservice.login();
} catch (OKMWebserviceExceptione){

}

Available methods

{{Warning|OKMWebservice library methods are still not finished, this is a list of actuals.}}

void refreshConfiguration(String host, String userName, String password);
// Auth
String login();
void logout(String token);
Dictionary<String, int> getGrantedRoles(String nodePath);
Dictionary<String, int> getGrantedRoles(String token, String nodePath);
Dictionary<String, int> getGrantedUsers(String nodePath);
Dictionary<String, int> getGrantedUsers(String token, String nodePath);
String[] getRoles(String nodePath);
String[] getRoles(String token, String nodePath);
String[] getUsers(String nodePath);
String[] getUsers(String token, String nodePath);
void grantRole(String nodePath, String role, int permission, bool recursive);
void grantRole(String token, String nodePath, String role, int permission, bool recursive);
void grantUser(String nodePath, String user, int permission, bool recursive);
void grantUser(String token, String nodePath, String user, int permission, bool recursive);
void revokeRole(String nodePath, String role, int permission, bool recursive);
void revokeRole(String token, String nodePath, String role, int permission, bool recursive);
void revokeUser(String nodePath, String user, int permission, bool recursive);
void revokeUser(String token, String nodePath, String user, int permission, bool recursive);
String[] getRolesByUser(String nodePath, String user);
String[] getRolesByUser(String token, String nodePath, String user);
String[] getUsersByRole(String nodePath, String role);
String[] getUsersByRole(String token, String nodePath, String role);
String getMail(String nodePath, String user);
String getMail(String token, String nodePath, String user);
String getName(String nodePath, String user);
String getName(String token, String nodePath, String user);
// Repository
OKMFolderBean getTemplatesFolder();
OKMFolderBean getTemplatesFolder(String token);
OKMFolderBean getPersonalFolder();
OKMFolderBean getPersonalFolder(String token);
OKMFolderBean getRootFolder();
OKMFolderBean getRootFolder(String token);
// Document
void create(String docPath, byte[] data);
void create(String token, String docPath, byte[] data);
void checkout(String docPath);
void checkout(String token, String docPath);
void cancelCheckout(String docPath);
void cancelCheckout(String token, String docPath);
void checkin(String docPath, byte[] data, String comment);
void checkin(String token, String docPath, byte[] data, String comment);
bool documentExists(String docPath);
bool documentExists(String token, String docPath);
// Folder
OKMFolderBean[] getChildren(String fldPath);
OKMFolderBean[] getChildren(String token, String fldPath);
OKMQueryResultBean[] find(OKMQueryParamsBean queryParams);
OKMQueryResultBean[] find(String token, OKMQueryParamsBean queryParams);
void create(OKMFolderBean folderBean);
void create(String token, OKMFolderBean folderBean);
void rename(String fldPath, String newName);
void rename(String token, String fldPath, String newName);
void delete(String fldPath);
void delete(String token, String fldPath);
// PropertyGroup
void addGroup(String nodePath, String grpName);
void addGroup(String token, String nodePath, String grpName);
void setPropertiesSimple(String nodePath, String grpName, Dictionary<String, String> propertiesMap);
void setPropertiesSimple(String token, String nodePath, String grpName, Dictionary<String, String> propertiesMap);