##// END OF EJS Templates
use short id in ancestor
use short id in ancestor

File last commit:

r3457:08e81155 beta
r3506:9f9e7c93 beta
Show More
api.rst
982 lines | 28.3 KiB | text/x-rst | RstLexer
API docs
r1446 .. _api:
docs
r2095 ===
API docs
r1446 API
===
Starting from RhodeCode version 1.2 a simple API was implemented.
Extended API...
r1500 There's a single schema for calling all api methods. API is implemented
return proper id from users_group...
r2531 with JSON protocol both ways. An url to send API request to RhodeCode is
Extended API...
r1500 <your_server>/_admin/api
API docs
r1446
docs update
r1839 API ACCESS FOR WEB VIEWS
++++++++++++++++++++++++
API docs
r1446
whitespace cleanup
r3224 API access can also be turned on for each web view in RhodeCode that is
decorated with `@LoginRequired` decorator. To enable API access simple change
the standard login decorator to `@LoginRequired(api_access=True)`.
After this change, a rhodecode view can be accessed without login by adding a
docs update
r1911 GET parameter `?api_key=<api_key>` to url. By default this is only
Added instruction on enabling the API access to web views
r1812 enabled on RSS/ATOM feed views.
docs update
r1839 API ACCESS
++++++++++
changed API to match fully JSON-RPC specs
r1708 All clients are required to send JSON-RPC spec JSON data::
API docs
r1446
whitespace cleanup
r3224 {
API docs improvement....
r2143 "id:"<id>",
API docs
r1446 "api_key":"<api_key>",
"method":"<method_name>",
"args":{"<arg_key>":"<arg_val>"}
}
Extended API...
r1500 Example call for autopulling remotes repos using curl::
changed API to match fully JSON-RPC specs
r1708 curl https://server.com/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}'
Extended API...
r1500
Nicolas VINOT
[API] Update doc
r1592 Simply provide
changed API to match fully JSON-RPC specs
r1708 - *id* A value of any type, which is used to match the response with the request that it is replying to.
Extended API...
r1500 - *api_key* for access and permission validation.
- *method* is name of method to call
- *args* is an key:value list of arguments to pass to method
Nicolas VINOT
[API] Update doc
r1592
API docs
r1446 .. note::
Nicolas VINOT
[API] Update doc
r1592
api_key can be found in your user account page
changed API to match fully JSON-RPC specs
r1708 RhodeCode API will return always a JSON-RPC response::
Nicolas VINOT
[API] Update doc
r1592
whitespace cleanup
r3224 {
API docs improvement....
r2143 "id":<id>, # matching id sent by request
"result": "<result>"|null, # JSON formatted result, null if any errors
"error": "null"|<error_message> # JSON formatted error (if any)
API docs
r1446 }
All responses from API will be `HTTP/1.0 200 OK`, if there's an error while
Nicolas VINOT
[API] Update doc
r1592 calling api *error* key from response will contain failure description
API docs
r1446 and result will be null.
created rhodecode-api binary script for working with api via cli...
r2379
API CLIENT
++++++++++
return proper id from users_group...
r2531 From version 1.4 RhodeCode adds a script that allows to easily
created rhodecode-api binary script for working with api via cli...
r2379 communicate with API. After installing RhodeCode a `rhodecode-api` script
will be available.
To get started quickly simply run::
rhodecode-api _create_config --apikey=<youapikey> --apihost=<rhodecode host>
whitespace cleanup
r3224
created rhodecode-api binary script for working with api via cli...
r2379 This will create a file named .config in the directory you executed it storing
json config file with credentials. You can skip this step and always provide
both of the arguments to be able to communicate with server
after that simply run any api command for example get_repo::
whitespace cleanup
r3224
created rhodecode-api binary script for working with api via cli...
r2379 rhodecode-api get_repo
calling {"api_key": "<apikey>", "id": 75, "args": {}, "method": "get_repo"} to http://127.0.0.1:5000
rhodecode said:
{'error': 'Missing non optional `repoid` arg in JSON DATA',
'id': 75,
'result': None}
Ups looks like we forgot to add an argument
Let's try again now giving the repoid as parameters::
whitespace cleanup
r3224 rhodecode-api get_repo repoid:rhodecode
created rhodecode-api binary script for working with api via cli...
r2379 calling {"api_key": "<apikey>", "id": 39, "args": {"repoid": "rhodecode"}, "method": "get_repo"} to http://127.0.0.1:5000
rhodecode said:
{'error': None,
'id': 39,
'result': <json data...>}
API docs
r1446 API METHODS
+++++++++++
Nicolas VINOT
[API] Update doc
r1592
API docs
r1446 pull
----
Nicolas VINOT
[API] Update doc
r1592 Pulls given repo from remote location. Can be used to automatically keep
remote repos up to date. This command can be executed only using api_key
Extended API...
r1500 belonging to user with admin rights
INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "pull"
args : {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
Nicolas VINOT
[API] Update doc
r1592 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
result : "Pulled from `<reponame>`"
Nicolas VINOT
[API] Update doc
r1592 error : null
API: Added option to rescann repositories via api call
r2697 rescan_repos
------------
Dispatch rescan repositories action. If remove_obsolete is set
RhodeCode will delete repos that are in database but not in the filesystem.
whitespace cleanup
r3224 This command can be executed only using api_key belonging to user with admin
API: Added option to rescann repositories via api call
r2697 rights.
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "rescan_repos"
args : {
"remove_obsolete" : "<boolean = Optional(False)>"
}
OUTPUT::
id : <id_given_in_input>
whitespace cleanup
r3224 result : "{'added': [<list of names of added repos>],
API: Added option to rescann repositories via api call
r2697 'removed': [<list of names of removed repos>]}"
error : null
API invalidate_cache function ref #733
r3235 invalidate_cache
----------------
Invalidate cache for repository.
This command can be executed only using api_key belonging to user with admin
rights or regular user that have write or admin or write access to repository.
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "invalidate_cache"
args : {
"repoid" : "<reponame or repo_id>"
}
OUTPUT::
id : <id_given_in_input>
result : "Cache for repository `<reponame>` was invalidated: invalidated cache keys: <list_of_cache_keys>"
error : null
added API call for locking/unlocking repositories
r2737 lock
----
Implemented API calls for non-admin users for locking/unlocking repositories
r3161 Set locking state on given repository by given user. If userid param is skipped
calling lock function without lock attribute, will return lock state
r3457 , then it is set to id of user whos calling this method. If locked param is skipped
then function shows current lock state of given repo.
whitespace cleanup
r3224 This command can be executed only using api_key belonging to user with admin
Implemented API calls for non-admin users for locking/unlocking repositories
r3161 rights or regular user that have admin or write access to repository.
added API call for locking/unlocking repositories
r2737
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "lock"
args : {
"repoid" : "<reponame or repo_id>"
Implemented API calls for non-admin users for locking/unlocking repositories
r3161 "userid" : "<user_id or username = Optional(=apiuser)>",
calling lock function without lock attribute, will return lock state
r3457 "locked" : "<bool true|false = Optional(=None)>"
added API call for locking/unlocking repositories
r2737 }
OUTPUT::
id : <id_given_in_input>
result : "User `<username>` set lock state for repo `<reponame>` to `true|false`"
error : null
added API method for checking IP
r3126 show_ip
-------
Shows IP address as seen from RhodeCode server, together with all
defined IP addresses for given user.
whitespace cleanup
r3224 This command can be executed only using api_key belonging to user with admin
added API method for checking IP
r3126 rights.
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "show_ip"
args : {
"userid" : "<user_id or username>",
}
OUTPUT::
id : <id_given_in_input>
result : {
"ip_addr_server": <ip_from_clien>",
"user_ips": [
{
"ip_addr": "<ip_with_mask>",
"ip_range": ["<start_ip>", "<end_ip>"],
},
...
]
}
whitespace cleanup
r3224
added API method for checking IP
r3126 error : null
api review...
r1843 get_user
--------
API get_user and get_repo methods can fetch by id or names
r2010 Get's an user by username or user_id, Returns empty result if user is not found.
API method get_user can be executed by non-admin users ref #539
r3162 If userid param is skipped it is set to id of user who is calling this method.
whitespace cleanup
r3224 This command can be executed only using api_key belonging to user with admin
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 rights, or regular users that cannot specify different userid than theirs
api review...
r1843
#227 Initial version of repository groups permissions system...
r1982
api review...
r1843 INPUT::
API docs improvement....
r2143 id : <id_for_response>
api review...
r1843 api_key : "<api_key>"
method : "get_user"
whitespace cleanup
r3224 args : {
API method get_user can be executed by non-admin users ref #539
r3162 "userid" : "<username or user_id Optional(=apiuser)>"
api review...
r1843 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
whitespace cleanup
r3224 result: None if user does not exist or
api review...
r1843 {
add ipaddresses to repo data on API calls
r3127 "user_id" : "<user_id>",
updated api docs
r3213 "api_key" : "<api_key>",
add ipaddresses to repo data on API calls
r3127 "username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"emails": "<list_of_all_additional_emails>",
"ip_addresses": "<list_of_ip_addresses_for_user>",
"active" : "<bool>",
"admin" :  "<bool>",
"ldap_dn" : "<ldap_dn>",
"last_login": "<last_login>",
#404 API extensions for showing permission for users...
r2151 "permissions": {
"global": ["hg.create.repository",
"repository.read",
"hg.register.manual_activate"],
"repositories": {"repo1": "repository.none"},
"repositories_groups": {"Group1": "group.read"}
},
api review...
r1843 }
error: null
Nicolas VINOT
[API] Update doc
r1592 get_users
---------
Lists all existing users. This command can be executed only using api_key
belonging to user with admin rights.
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "get_users"
args : { }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
Nicolas VINOT
[API] Update doc
r1592 result: [
{
add ipaddresses to repo data on API calls
r3127 "user_id" : "<user_id>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"emails": "<list_of_all_additional_emails>",
"ip_addresses": "<list_of_ip_addresses_for_user>",
"active" : "<bool>",
"admin" :  "<bool>",
"ldap_dn" : "<ldap_dn>",
"last_login": "<last_login>",
Nicolas VINOT
[API] Update doc
r1592 },
Mads Kiilerich
coding style: fix trailing and leading spaces and tabs
r3267 …
Nicolas VINOT
[API] Update doc
r1592 ]
error: null
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 create_user
-----------
whitespace cleanup
r3224 Creates new user. This command can
create user api_doc update
r1909 be executed only using api_key belonging to user with admin rights.
Nicolas VINOT
[API] Update doc
r1592
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "create_user"
args : {
"username" : "<username>",
return proper id from users_group...
r2531 "email" : "<useremail>",
Nicolas VINOT
[API] Update doc
r1592 "password" : "<password>",
return proper id from users_group...
r2531 "firstname" : "<firstname> = Optional(None)",
"lastname" : "<lastname> = Optional(None)",
"active" : "<bool> = Optional(True)",
"admin" : "<bool> = Optional(False)",
"ldap_dn" : "<ldap_dn> = Optional(None)"
Nicolas VINOT
[API] Update doc
r1592 }
Extended API...
r1500
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
Nicolas VINOT
[API] Update doc
r1592 result: {
return proper id from users_group...
r2531 "msg" : "created new user `<username>`",
API, added delete_user method....
r2365 "user": {
return proper id from users_group...
r2531 "user_id" : "<user_id>",
API, added delete_user method....
r2365 "username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
return proper id from users_group...
r2531 "emails": "<list_of_all_additional_emails>",
API, added delete_user method....
r2365 "active" : "<bool>",
"admin" :  "<bool>",
"ldap_dn" : "<ldap_dn>",
"last_login": "<last_login>",
},
Nicolas VINOT
[API] Update doc
r1592 }
error: null
#227 Initial version of repository groups permissions system...
r1982
API added explicit method for updating user account
r2002 update_user
-----------
whitespace cleanup
r3224 updates given user if such user exists. This command can
API added explicit method for updating user account
r2002 be executed only using api_key belonging to user with admin rights.
INPUT::
API docs improvement....
r2143 id : <id_for_response>
API added explicit method for updating user account
r2002 api_key : "<api_key>"
method : "update_user"
args : {
API updates...
r2009 "userid" : "<user_id or username>",
API method get_user can be executed by non-admin users ref #539
r3162 "username" : "<username> = Optional(None)",
"email" : "<useremail> = Optional(None)",
"password" : "<password> = Optional(None)",
"firstname" : "<firstname> = Optional(None)",
"lastname" : "<lastname> = Optional(None)",
"active" : "<bool> = Optional(None)",
"admin" : "<bool> = Optional(None)",
"ldap_dn" : "<ldap_dn> = Optional(None)"
API added explicit method for updating user account
r2002 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
API added explicit method for updating user account
r2002 result: {
API: update_user returns new updated user data
r2507 "msg" : "updated user ID:<userid> <username>",
"user": {
return proper id from users_group...
r2531 "user_id" : "<user_id>",
API: update_user returns new updated user data
r2507 "username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
return proper id from users_group...
r2531 "emails": "<list_of_all_additional_emails>",
API: update_user returns new updated user data
r2507 "active" : "<bool>",
"admin" :  "<bool>",
"ldap_dn" : "<ldap_dn>",
"last_login": "<last_login>",
whitespace cleanup
r3224 },
API, added delete_user method....
r2365 }
error: null
delete_user
-----------
whitespace cleanup
r3224 deletes givenuser if such user exists. This command can
API, added delete_user method....
r2365 be executed only using api_key belonging to user with admin rights.
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "delete_user"
args : {
"userid" : "<user_id or username>",
}
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
API, added delete_user method....
r2365 result: {
return proper id from users_group...
r2531 "msg" : "deleted user ID:<userid> <username>",
"user": null
API added explicit method for updating user account
r2002 }
error: null
Nicolas VINOT
[API] Update doc
r1592 get_users_group
---------------
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Gets an existing user group. This command can be executed only using api_key
Nicolas VINOT
[API] Update doc
r1592 belonging to user with admin rights.
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "get_users_group"
args : {
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "usersgroupid" : "<user group id or name>"
Nicolas VINOT
[API] Update doc
r1592 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
Nicolas VINOT
[API] Update doc
r1592 result : None if group not exist
{
return proper id from users_group...
r2531 "users_group_id" : "<id>",
"group_name" : "<groupname>",
"active": "<bool>",
Nicolas VINOT
[API] Update doc
r1592 "members" : [
whitespace cleanup
r3224 {
return proper id from users_group...
r2531 "user_id" : "<user_id>",
api review...
r1843 "username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
return proper id from users_group...
r2531 "emails": "<list_of_all_additional_emails>",
api review...
r1843 "active" : "<bool>",
"admin" :  "<bool>",
return proper id from users_group...
r2531 "ldap_dn" : "<ldap_dn>",
"last_login": "<last_login>",
api review...
r1843 },
…
]
Nicolas VINOT
[API] Update doc
r1592 }
error : null
#227 Initial version of repository groups permissions system...
r1982
api review...
r1843 get_users_groups
----------------
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Lists all existing user groups. This command can be executed only using
api review...
r1843 api_key belonging to user with admin rights.
#227 Initial version of repository groups permissions system...
r1982
api review...
r1843 INPUT::
API docs improvement....
r2143 id : <id_for_response>
api review...
r1843 api_key : "<api_key>"
method : "get_users_groups"
args : { }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
api review...
r1843 result : [
{
return proper id from users_group...
r2531 "users_group_id" : "<id>",
"group_name" : "<groupname>",
"active": "<bool>",
},
…
api review...
r1843 ]
error : null
Extended API...
r1500 create_users_group
------------------
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Creates new user group. This command can be executed only using api_key
Extended API...
r1500 belonging to user with admin rights
#227 Initial version of repository groups permissions system...
r1982
Extended API...
r1500 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "create_users_group"
args: {
api review...
r1843 "group_name": "<groupname>",
return proper id from users_group...
r2531 "active":"<bool> = Optional(True)"
Nicolas VINOT
[API] Update doc
r1592 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
Nicolas VINOT
[API] Update doc
r1592 result: {
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "msg": "created new user group `<groupname>`",
return proper id from users_group...
r2531 "users_group": {
"users_group_id" : "<id>",
"group_name" : "<groupname>",
"active": "<bool>",
},
Nicolas VINOT
[API] Update doc
r1592 }
error: null
#227 Initial version of repository groups permissions system...
r1982
implements #329...
r1793 add_user_to_users_group
-----------------------
Nicolas VINOT
[API] Update doc
r1592
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Adds a user to a user group. If user exists in that group success will be
API changes...
r1989 `false`. This command can be executed only using api_key
Nicolas VINOT
[API] Update doc
r1592 belonging to user with admin rights
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "add_user_users_group"
args: {
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "usersgroupid" : "<user group id or name>",
return proper id from users_group...
r2531 "userid" : "<user_id or username>",
Nicolas VINOT
[API] Update doc
r1592 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
Nicolas VINOT
[API] Update doc
r1592 result: {
API changes...
r1989 "success": True|False # depends on if member is in group
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "msg": "added member `<username>` to user group `<groupname>` |
API changes...
r1989 User is already in that group"
}
error: null
remove_user_from_users_group
----------------------------
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Removes a user from a user group. If user is not in given group success will
whitespace cleanup
r3224 be `false`. This command can be executed only
API changes...
r1989 using api_key belonging to user with admin rights
INPUT::
API docs improvement....
r2143 id : <id_for_response>
API changes...
r1989 api_key : "<api_key>"
method : "remove_user_from_users_group"
args: {
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "usersgroupid" : "<user group id or name>",
return proper id from users_group...
r2531 "userid" : "<user_id or username>",
API changes...
r1989 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
API changes...
r1989 result: {
"success": True|False, # depends on if member is in group
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "msg": "removed member <username> from user group <groupname> |
API changes...
r1989 User wasn't in group"
Nicolas VINOT
[API] Update doc
r1592 }
error: null
#227 Initial version of repository groups permissions system...
r1982
api review...
r1843 get_repo
--------
Api docs fixes...
r2146 Gets an existing repository by it's name or repository_id. Members will return
whitespace cleanup
r3224 either users_group or user associated to that repository. This command can be
executed only using api_key belonging to user with admin
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 rights or regular user that have at least read access to repository.
api review...
r1843
#227 Initial version of repository groups permissions system...
r1982
api review...
r1843 INPUT::
API docs improvement....
r2143 id : <id_for_response>
api review...
r1843 api_key : "<api_key>"
method : "get_repo"
args: {
API get_user and get_repo methods can fetch by id or names
r2010 "repoid" : "<reponame or repo_id>"
api review...
r1843 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
api review...
r1843 result: None if repository does not exist or
{
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "repo_id" : "<repo_id>",
"repo_name" : "<reponame>"
"repo_type" : "<repo_type>",
"clone_uri" : "<clone_uri>",
"enable_downloads": "<bool>",
"enable_locking": "<bool>",
whitespace cleanup
r3224 "enable_statistics": "<bool>",
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "private": "<bool>",
whitespace cleanup
r3224 "created_on" : "<date_time_created>",
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "description" : "<description>",
"landing_rev": "<landing_rev>",
added last_changeset information in get_repo API function
r3174 "last_changeset": {
"author": "<full_author>",
"date": "<date_time_of_commit>",
"message": "<commit_message>",
"raw_id": "<raw_id>",
"revision": "<numeric_revision>",
"short_id": "<short_id>"
}
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "owner": "<repo_owner>",
"fork_of": "<name_of_fork_parent>",
api review...
r1843 "members" : [
whitespace cleanup
r3224 {
updated api docs
r3213 "type": "user",
added last_changeset information in get_repo API function
r3174 "user_id" : "<user_id>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"emails": "<list_of_all_additional_emails>",
"active" : "<bool>",
"admin" :  "<bool>",
"ldap_dn" : "<ldap_dn>",
"last_login": "<last_login>",
api review...
r1843 "permission" : "repository.(read|write|admin)"
},
…
whitespace cleanup
r3224 {
updated api docs
r3213 "type": "users_group",
api review...
r1843 "id" : "<usersgroupid>",
"name" : "<usersgroupname>",
"active": "<bool>",
"permission" : "repository.(read|write|admin)"
},
…
]
updated api docs
r3213 "followers": [
{
"user_id" : "<user_id>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"emails": "<list_of_all_additional_emails>",
"ip_addresses": "<list_of_ip_addresses_for_user>",
"active" : "<bool>",
"admin" :  "<bool>",
"ldap_dn" : "<ldap_dn>",
whitespace cleanup
r3224 "last_login": "<last_login>",
updated api docs
r3213 },
whitespace cleanup
r3224 …
updated api docs
r3213 ]
api review...
r1843 }
error: null
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 get_repos
---------
whitespace cleanup
r3224 Lists all existing repositories. This command can be executed only using
api_key belonging to user with admin rights or regular user that have
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 admin, write or read access to repository.
Nicolas VINOT
[API] Update doc
r1592
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "get_repos"
args: { }
Extended API...
r1500
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
Nicolas VINOT
[API] Update doc
r1592 result: [
{
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "repo_id" : "<repo_id>",
"repo_name" : "<reponame>"
"repo_type" : "<repo_type>",
"clone_uri" : "<clone_uri>",
"private": : "<bool>",
whitespace cleanup
r3224 "created_on" : "<datetimecreated>",
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "description" : "<description>",
"landing_rev": "<landing_rev>",
"owner": "<repo_owner>",
"fork_of": "<name_of_fork_parent>",
"enable_downloads": "<bool>",
"enable_locking": "<bool>",
whitespace cleanup
r3224 "enable_statistics": "<bool>",
Nicolas VINOT
[API] Update doc
r1592 },
…
]
error: null
implements #330 api method for listing nodes at particular revision...
r1810 get_repo_nodes
--------------
whitespace cleanup
r3224 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
implements #330 api method for listing nodes at particular revision...
r1810 with admin rights
#227 Initial version of repository groups permissions system...
r1982
implements #330 api method for listing nodes at particular revision...
r1810 INPUT::
API docs improvement....
r2143 id : <id_for_response>
implements #330 api method for listing nodes at particular revision...
r1810 api_key : "<api_key>"
method : "get_repo_nodes"
args: {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
implements #330 api method for listing nodes at particular revision...
r1810 "revision" : "<revision>",
"root_path" : "<root_path>",
return proper id from users_group...
r2531 "ret_type" : "<ret_type> = Optional('all')"
implements #330 api method for listing nodes at particular revision...
r1810 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
implements #330 api method for listing nodes at particular revision...
r1810 result: [
{
"name" : "<name>"
"type" : "<type>",
},
…
]
error: null
Nicolas VINOT
[API] Update doc
r1592 create_repo
-----------
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 Creates a repository. If repository name contains "/", all needed repository
whitespace cleanup
r3224 groups will be created. For example "foo/bar/baz" will create groups
"foo", "bar" (with "foo" as parent), and create "baz" repository with
"bar" as group. This command can be executed only using api_key belonging to user with admin
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 rights or regular user that have create repository permission. Regular users
cannot specify owner parameter
Nicolas VINOT
[API] Update doc
r1592
#227 Initial version of repository groups permissions system...
r1982
Nicolas VINOT
[API] Update doc
r1592 INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
method : "create_repo"
args: {
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "repo_name" : "<reponame>",
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 "owner" : "<onwer_name_or_id = Optional(=apiuser)>",
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "repo_type" : "<repo_type> = Optional('hg')",
"description" : "<description> = Optional('')",
"private" : "<bool> = Optional(False)",
"clone_uri" : "<clone_uri> = Optional(None)",
"landing_rev" : "<landing_rev> = Optional('tip')",
"enable_downloads": "<bool> = Optional(False)",
"enable_locking": "<bool> = Optional(False)",
"enable_statistics": "<bool> = Optional(False)",
Nicolas VINOT
[API] Update doc
r1592 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
api review...
r1843 result: {
return proper id from users_group...
r2531 "msg": "Created new repository `<reponame>`",
API: create_repo returns now repo object after creation
r2378 "repo": {
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "repo_id" : "<repo_id>",
"repo_name" : "<reponame>"
"repo_type" : "<repo_type>",
"clone_uri" : "<clone_uri>",
"private": : "<bool>",
whitespace cleanup
r3224 "created_on" : "<datetimecreated>",
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "description" : "<description>",
"landing_rev": "<landing_rev>",
#699: fix missing fork docs for API
r3122 "owner": "<username or user_id>",
Default parameters are now also used for creating repos using API calls, and initial repo scanner...
r3115 "fork_of": "<name_of_fork_parent>",
"enable_downloads": "<bool>",
"enable_locking": "<bool>",
whitespace cleanup
r3224 "enable_statistics": "<bool>",
API: create_repo returns now repo object after creation
r2378 },
api review...
r1843 }
Nicolas VINOT
[API] Update doc
r1592 error: null
#227 Initial version of repository groups permissions system...
r1982
#699: fix missing fork docs for API
r3122 fork_repo
---------
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 Creates a fork of given repo. In case of using celery this will
#699: fix missing fork docs for API
r3122 immidiatelly return success message, while fork is going to be created
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 asynchronous. This command can be executed only using api_key belonging to
user with admin rights or regular user that have fork permission, and at least
read access to forking repository. Regular users cannot specify owner parameter.
#699: fix missing fork docs for API
r3122
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "fork_repo"
args: {
"repoid" : "<reponame or repo_id>",
"fork_name": "<forkname>",
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 "owner": "<username or user_id = Optional(=apiuser)>",
#699: fix missing fork docs for API
r3122 "description": "<description>",
"copy_permissions": "<bool>",
"private": "<bool>",
"landing_rev": "<landing_rev>"
whitespace cleanup
r3224
#699: fix missing fork docs for API
r3122 }
OUTPUT::
id : <id_given_in_input>
result: {
"msg": "Created fork of `<reponame>` as `<forkname>`",
"success": true
}
error: null
implements #361 API method for deleting repositories
r2003 delete_repo
-----------
whitespace cleanup
r3224 Deletes a repository. This command can be executed only using api_key belonging to user with admin
API methods create_repo, fork_repo, delete_repo, get_repo, get_repos...
r3163 rights or regular user that have admin access to repository.
implements #361 API method for deleting repositories
r2003
INPUT::
API docs improvement....
r2143 id : <id_for_response>
implements #361 API method for deleting repositories
r2003 api_key : "<api_key>"
method : "delete_repo"
args: {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
implements #361 API method for deleting repositories
r2003 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
implements #361 API method for deleting repositories
r2003 result: {
return proper id from users_group...
r2531 "msg": "Deleted repository `<reponame>`",
"success": true
implements #361 API method for deleting repositories
r2003 }
error: null
#227 Initial version of repository groups permissions system...
r1982 grant_user_permission
---------------------
Nicolas VINOT
[API] Update doc
r1592
#227 Initial version of repository groups permissions system...
r1982 Grant permission for user on given repository, or update existing one
whitespace cleanup
r3224 if found. This command can be executed only using api_key belonging to user
#227 Initial version of repository groups permissions system...
r1982 with admin rights.
Nicolas VINOT
[API] Update doc
r1592
INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
#227 Initial version of repository groups permissions system...
r1982 method : "grant_user_permission"
Nicolas VINOT
[API] Update doc
r1592 args: {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
"userid" : "<username or user_id>"
#227 Initial version of repository groups permissions system...
r1982 "perm" : "(repository.(none|read|write|admin))",
}
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
#227 Initial version of repository groups permissions system...
r1982 result: {
return proper id from users_group...
r2531 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
"success": true
#227 Initial version of repository groups permissions system...
r1982 }
error: null
revoke_user_permission
----------------------
whitespace cleanup
r3224 Revoke permission for user on given repository. This command can be executed
#227 Initial version of repository groups permissions system...
r1982 only using api_key belonging to user with admin rights.
INPUT::
API docs improvement....
r2143 id : <id_for_response>
#227 Initial version of repository groups permissions system...
r1982 api_key : "<api_key>"
method : "revoke_user_permission"
args: {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
"userid" : "<username or user_id>"
Nicolas VINOT
[API] Update doc
r1592 }
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
api review...
r1843 result: {
return proper id from users_group...
r2531 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
"success": true
api review...
r1843 }
Nicolas VINOT
[API] Update doc
r1592 error: null
implements #329...
r1793
#227 Initial version of repository groups permissions system...
r1982
grant_users_group_permission
----------------------------
implements #329...
r1793
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Grant permission for user group on given repository, or update
whitespace cleanup
r3224 existing one if found. This command can be executed only using
#227 Initial version of repository groups permissions system...
r1982 api_key belonging to user with admin rights.
implements #329...
r1793
INPUT::
API docs improvement....
r2143 id : <id_for_response>
implements #329...
r1793 api_key : "<api_key>"
#227 Initial version of repository groups permissions system...
r1982 method : "grant_users_group_permission"
args: {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "usersgroupid" : "<user group id or name>"
#227 Initial version of repository groups permissions system...
r1982 "perm" : "(repository.(none|read|write|admin))",
}
OUTPUT::
return proper id from users_group...
r2531 id : <id_given_in_input>
#227 Initial version of repository groups permissions system...
r1982 result: {
return proper id from users_group...
r2531 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
"success": true
#227 Initial version of repository groups permissions system...
r1982 }
error: null
whitespace cleanup
r3224
#227 Initial version of repository groups permissions system...
r1982 revoke_users_group_permission
-----------------------------
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 Revoke permission for user group on given repository.This command can be
#227 Initial version of repository groups permissions system...
r1982 executed only using api_key belonging to user with admin rights.
INPUT::
API docs improvement....
r2143 id : <id_for_response>
#227 Initial version of repository groups permissions system...
r1982 api_key : "<api_key>"
method : "revoke_users_group_permission"
implements #329...
r1793 args: {
return proper id from users_group...
r2531 "repoid" : "<reponame or repo_id>"
Mads Kiilerich
"Users groups" is grammatically incorrect English - rename to "user groups"...
r3410 "usersgroupid" : "<user group id or name>"
api review...
r1843 }
#227 Initial version of repository groups permissions system...
r1982
api review...
r1843 OUTPUT::
#227 Initial version of repository groups permissions system...
r1982
return proper id from users_group...
r2531 id : <id_given_in_input>
api review...
r1843 result: {
return proper id from users_group...
r2531 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
"success": true
api review...
r1843 }
whitespace cleanup
r3224 error: null