Mercurial > public > src > rhodecode
diff docs/api/api.rst @ 1928:0771f0f5ab28 beta
api review
- normalized parameters (repo_name, group_name)
- added return values to some create functions
- fixed docs
- fixed bugs of parameters mismatch on docs
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 07 Jan 2012 02:27:52 +0200 |
parents | 9da24750f563 |
children | f2bd5b0c1094 |
line wrap: on
line diff
--- a/docs/api/api.rst Sat Jan 07 01:33:21 2012 +0200 +++ b/docs/api/api.rst Sat Jan 07 02:27:52 2012 +0200 @@ -74,15 +74,47 @@ api_key : "<api_key>" method : "pull" args : { - "repo" : "<repo_name>" + "repo_name" : "<reponame>" } OUTPUT:: - result : "Pulled from <repo_name>" + result : "Pulled from <reponame>" error : null +get_user +-------- + +Get's an user by username, Returns empty result if user is not found. +This command can be executed only using api_key belonging to user with admin +rights. + +INPUT:: + + api_key : "<api_key>" + method : "get_user" + args : { + "username" : "<username>" + } + +OUTPUT:: + + result: None if user does not exist or + { + "id" : "<id>", + "username" : "<username>", + "firstname": "<firstname>", + "lastname" : "<lastname>", + "email" : "<email>", + "active" : "<bool>", + "admin" : "<bool>", + "ldap" : "<ldap_dn>" + } + + error: null + + get_users --------- @@ -136,46 +168,11 @@ OUTPUT:: result: { + "id" : "<new_user_id>", "msg" : "created new user <username>" } error: null -get_users_groups ----------------- - -Lists all existing users groups. This command can be executed only using api_key -belonging to user with admin rights. - -INPUT:: - - api_key : "<api_key>" - method : "get_users_groups" - args : { } - -OUTPUT:: - - result : [ - { - "id" : "<id>", - "name" : "<name>", - "active": "<bool>", - "members" : [ - { - "id" : "<userid>", - "username" : "<username>", - "firstname": "<firstname>", - "lastname" : "<lastname>", - "email" : "<email>", - "active" : "<bool>", - "admin" : "<bool>", - "ldap" : "<ldap_dn>" - }, - … - ] - } - ] - error : null - get_users_group --------------- @@ -194,24 +191,61 @@ result : None if group not exist { - "id" : "<id>", - "name" : "<name>", - "active": "<bool>", + "id" : "<id>", + "group_name" : "<groupname>", + "active": "<bool>", "members" : [ - { "id" : "<userid>", - "username" : "<username>", - "firstname": "<firstname>", - "lastname" : "<lastname>", - "email" : "<email>", - "active" : "<bool>", - "admin" : "<bool>", - "ldap" : "<ldap_dn>" - }, - … - ] + { "id" : "<userid>", + "username" : "<username>", + "firstname": "<firstname>", + "lastname" : "<lastname>", + "email" : "<email>", + "active" : "<bool>", + "admin" : "<bool>", + "ldap" : "<ldap_dn>" + }, + … + ] } error : null +get_users_groups +---------------- + +Lists all existing users groups. This command can be executed only using +api_key belonging to user with admin rights. + +INPUT:: + + api_key : "<api_key>" + method : "get_users_groups" + args : { } + +OUTPUT:: + + result : [ + { + "id" : "<id>", + "group_name" : "<groupname>", + "active": "<bool>", + "members" : [ + { + "id" : "<userid>", + "username" : "<username>", + "firstname": "<firstname>", + "lastname" : "<lastname>", + "email" : "<email>", + "active" : "<bool>", + "admin" : "<bool>", + "ldap" : "<ldap_dn>" + }, + … + ] + } + ] + error : null + + create_users_group ------------------ @@ -223,7 +257,7 @@ api_key : "<api_key>" method : "create_users_group" args: { - "name": "<name>", + "group_name": "<groupname>", "active":"<bool> = True" } @@ -231,7 +265,7 @@ result: { "id": "<newusersgroupid>", - "msg": "created new users group <name>" + "msg": "created new users group <groupname>" } error: null @@ -258,6 +292,51 @@ } error: null +get_repo +-------- + +Gets an existing repository. This command can be executed only using api_key +belonging to user with admin rights + +INPUT:: + + api_key : "<api_key>" + method : "get_repo" + args: { + "repo_name" : "<reponame>" + } + +OUTPUT:: + + result: None if repository does not exist or + { + "id" : "<id>", + "repo_name" : "<reponame>" + "type" : "<type>", + "description" : "<description>", + "members" : [ + { "id" : "<userid>", + "username" : "<username>", + "firstname": "<firstname>", + "lastname" : "<lastname>", + "email" : "<email>", + "active" : "<bool>", + "admin" : "<bool>", + "ldap" : "<ldap_dn>", + "permission" : "repository.(read|write|admin)" + }, + … + { + "id" : "<usersgroupid>", + "name" : "<usersgroupname>", + "active": "<bool>", + "permission" : "repository.(read|write|admin)" + }, + … + ] + } + error: null + get_repos --------- @@ -275,7 +354,7 @@ result: [ { "id" : "<id>", - "name" : "<name>" + "repo_name" : "<reponame>" "type" : "<type>", "description" : "<description>" }, @@ -283,57 +362,13 @@ ] error: null -get_repo --------- - -Gets an existing repository. This command can be executed only using api_key -belonging to user with admin rights - -INPUT:: - - api_key : "<api_key>" - method : "get_repo" - args: { - "name" : "<name>" - } - -OUTPUT:: - - result: None if repository not exist - { - "id" : "<id>", - "name" : "<name>" - "type" : "<type>", - "description" : "<description>", - "members" : [ - { "id" : "<userid>", - "username" : "<username>", - "firstname": "<firstname>", - "lastname" : "<lastname>", - "email" : "<email>", - "active" : "<bool>", - "admin" : "<bool>", - "ldap" : "<ldap_dn>", - "permission" : "repository.(read|write|admin)" - }, - … - { - "id" : "<usersgroupid>", - "name" : "<usersgroupname>", - "active": "<bool>", - "permission" : "repository.(read|write|admin)" - }, - … - ] - } - error: null get_repo_nodes -------------- returns a list of nodes and it's children in a flat list for a given path -at given revision. It's possible to specify ret_type to show only files or -dirs. This command can be executed only using api_key belonging to user +at given revision. It's possible to specify ret_type to show only `files` or +`dirs`. This command can be executed only using api_key belonging to user with admin rights INPUT:: @@ -341,7 +376,7 @@ api_key : "<api_key>" method : "get_repo_nodes" args: { - "repo_name" : "<name>", + "repo_name" : "<reponame>", "revision" : "<revision>", "root_path" : "<root_path>", "ret_type" : "<ret_type>" = 'all' @@ -374,7 +409,7 @@ api_key : "<api_key>" method : "create_repo" args: { - "name" : "<name>", + "repo_name" : "<reponame>", "owner_name" : "<ownername>", "description" : "<description> = ''", "repo_type" : "<type> = 'hg'", @@ -383,7 +418,10 @@ OUTPUT:: - result: None + result: { + "id": "<newrepoid>", + "msg": "Created new repository <reponame>", + } error: null add_user_to_repo @@ -399,13 +437,15 @@ method : "add_user_to_repo" args: { "repo_name" : "<reponame>", - "username" : "<username>", + "username" : "<username>", "perm" : "(None|repository.(read|write|admin))", } OUTPUT:: - result: None + result: { + "msg" : "Added perm: <perm> for <username> in repo: <reponame>" + } error: null add_users_group_to_repo @@ -421,6 +461,12 @@ method : "add_users_group_to_repo" args: { "repo_name" : "<reponame>", - "group_name" : "<groupname>", + "group_name" : "<groupname>", "perm" : "(None|repository.(read|write|admin))", - } \ No newline at end of file + } +OUTPUT:: + + result: { + "msg" : Added perm: <perm> for <groupname> in repo: <reponame>" + } +