##// END OF EJS Templates
docs: update example output and example server configs...
docs: update example output and example server configs kallithea-api example output was not up-to-date, and the text was a little vague on whether you specify a hostname or a URL. The Nginx example config has been updated to assume a Kallithea backend server on localhost:5000, like the Apache example. The redundant ServerAlias option was removed from the Apache example.

File last commit:

r5496:2b2216e8 stable
r5496:2b2216e8 stable
Show More
api.rst
1026 lines | 32.1 KiB | text/x-rst | RstLexer
API docs
r1446 .. _api:
docs
r2095 ===
API docs
r1446 API
===
Michael V. DePalatis
docs: English and consistency corrections
r4955 Kallithea has a simple JSON RPC API with a single schema for calling all API
Mads Kiilerich
docs: improve the API documentation
r4879 methods. Everything is available by sending JSON encoded http(s) requests to
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 ``<your_server>/_admin/api``.
Mads Kiilerich
docs: improve the API documentation
r4879
API docs
r1446
Mads Kiilerich
docs: rework stuff...
r4902 API access for web views
docs update
r1839 ++++++++++++++++++++++++
API docs
r1446
Bradley M. Kuhn
Rename some strings examples and commands in documentation
r4192 API access can also be turned on for each web view in Kallithea that is
Michael V. DePalatis
docs: English and consistency corrections
r4955 decorated with the ``@LoginRequired`` decorator. Some views use
``@LoginRequired(api_access=True)`` and are always available. By default only
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 RSS/Atom feed views are enabled. Other views are
only available if they have been whitelisted. Edit the
Michael V. DePalatis
docs: English and consistency corrections
r4955 ``api_access_controllers_whitelist`` option in your .ini file and define views
Mads Kiilerich
docs: improve the API documentation
r4879 that should have API access enabled.
update docs about the API access whitelist option
r3769
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 For example, to enable API access to patch/diff, raw file and archive::
update docs about the API access whitelist option
r3769
cleanup code
r3777 api_access_controllers_whitelist =
update docs about the API access whitelist option
r3769 ChangesetController:changeset_patch,
ChangesetController:changeset_raw,
FilesController:raw,
FilesController:archivefile
Mads Kiilerich
docs: improve the API documentation
r4879 After this change, a Kallithea view can be accessed without login by adding a
Michael V. DePalatis
docs: English and consistency corrections
r4955 GET parameter ``?api_key=<api_key>`` to the URL.
update docs about the API access whitelist option
r3769
Mads Kiilerich
docs: improve the API documentation
r4879 Exposing raw diffs is a good way to integrate with
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 third-party services like code review, or build farms that can download archives.
Added instruction on enabling the API access to web views
r1812
Mads Kiilerich
docs: rework stuff...
r4902 API access
docs update
r1839 ++++++++++
Mads Kiilerich
docs: improve the API documentation
r4879 Clients must send JSON encoded JSON-RPC requests::
API docs
r1446
whitespace cleanup
r3224 {
Mads Kiilerich
docs: improve the API documentation
r4879 "id: "<id>",
"api_key": "<api_key>",
"method": "<method_name>",
"args": {"<arg_key>": "<arg_val>"}
API docs
r1446 }
Mads Kiilerich
docs: improve the API documentation
r4879 For example, to pull to a local "CPython" mirror using curl::
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 curl https://example.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
Mads Kiilerich
docs: improve the API documentation
r4879 In general, provide
- *id*, a value of any type, can be used to match the response with the request that it is replying to.
- *api_key*, for authentication and permission validation.
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 - *method*, the name of the method to call -- a list of available methods can be found below.
Mads Kiilerich
docs: improve the API documentation
r4879 - *args*, the arguments to pass to the method.
Nicolas VINOT
[API] Update doc
r1592
API docs
r1446 .. note::
Nicolas VINOT
[API] Update doc
r1592
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 api_key can be found or set on the user account page.
Nicolas VINOT
[API] Update doc
r1592
Mads Kiilerich
docs: improve the API documentation
r4879 The response to the JSON-RPC API call will always be a JSON structure::
Nicolas VINOT
[API] Update doc
r1592
whitespace cleanup
r3224 {
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 "id": <id>, # the id that was used in the request
"result": <result>|null, # JSON formatted result (null on error)
"error": null|<error_message> # JSON formatted error (null on success)
API docs
r1446 }
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 All responses from the API will be ``HTTP/1.0 200 OK``. If an error occurs,
Mads Kiilerich
docs: improve the API documentation
r4879 the reponse will have a failure description in *error* and
*result* will be null.
API docs
r1446
created rhodecode-api binary script for working with api via cli...
r2379
Mads Kiilerich
docs: rework stuff...
r4902 API client
created rhodecode-api binary script for working with api via cli...
r2379 ++++++++++
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 Kallithea comes with a ``kallithea-api`` command line tool, providing a convenient
Mads Kiilerich
docs: improve the API documentation
r4879 way to call the JSON-RPC API.
whitespace cleanup
r3224
Michael V. DePalatis
docs: English and consistency corrections
r4955 For example, to call ``get_repo``::
created rhodecode-api binary script for working with api via cli...
r2379
Søren Løvborg
docs: update example output and example server configs...
r5496 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo
created rhodecode-api binary script for working with api via cli...
r2379
Søren Løvborg
docs: update example output and example server configs...
r5496 Calling method get_repo => <Kallithea URL>
Server response
ERROR:"Missing non optional `repoid` arg in JSON DATA"
created rhodecode-api binary script for working with api via cli...
r2379
Michael V. DePalatis
docs: English and consistency corrections
r4955 Oops, looks like we forgot to add an argument. Let's try again, now
providing the ``repoid`` as a parameter::
created rhodecode-api binary script for working with api via cli...
r2379
Søren Løvborg
docs: update example output and example server configs...
r5496 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo repoid:myrepo
whitespace cleanup
r3224
Søren Løvborg
docs: update example output and example server configs...
r5496 Calling method get_repo => <Kallithea URL>
Server response
{
"clone_uri": null,
"created_on": "2015-08-31T14:55:19.042",
...
created rhodecode-api binary script for working with api via cli...
r2379
Michael V. DePalatis
docs: English and consistency corrections
r4955 To avoid specifying ``apihost`` and ``apikey`` every time, run::
Mads Kiilerich
docs: improve the API documentation
r4879
Søren Løvborg
docs: update example output and example server configs...
r5496 kallithea-api --save-config --apihost=<Kallithea URL> --apikey=<API key>
Mads Kiilerich
docs: improve the API documentation
r4879
Søren Løvborg
docs: update example output and example server configs...
r5496 This will create a ``~/.config/kallithea`` with the specified URL and API key
Mads Kiilerich
docs: improve the API documentation
r4879 so you don't have to specify them every time.
created rhodecode-api binary script for working with api via cli...
r2379
Mads Kiilerich
docs: rework stuff...
r4902 API methods
API docs
r1446 +++++++++++
Nicolas VINOT
[API] Update doc
r1592
API docs
r1446 pull
----
Mads Kiilerich
docs: improve the API documentation
r4879 Pull the given repo from remote location. Can be used to automatically keep
remote repos up to date.
This command can only be executed using the api_key of a user with admin rights.
Extended API...
r1500
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
------------
Michael V. DePalatis
docs: English and consistency corrections
r4955 Rescan repositories. If ``remove_obsolete`` is set,
Kallithea will delete repos that are in the database but not in the filesystem.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
API: Added option to rescann repositories via api call
r2697
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
----------------
Michael V. DePalatis
docs: English and consistency corrections
r4955 Invalidate the cache for a repository.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights,
or that of a regular user with admin or write access to the repository.
API invalidate_cache function ref #733
r3235
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "invalidate_cache"
args : {
"repoid" : "<reponame or repo_id>"
}
OUTPUT::
id : <id_given_in_input>
Mads Kiilerich
api: don't report invalidated cache_keys after invalidating a repo...
r3759 result : "Caches of repository `<reponame>`"
API invalidate_cache function ref #733
r3235 error : null
added API call for locking/unlocking repositories
r2737 lock
----
Mads Kiilerich
docs: improve the API documentation
r4879 Set the locking state on the given repository by the given user.
Michael V. DePalatis
docs: English and consistency corrections
r4955 If the param ``userid`` is skipped, it is set to the ID of the user who is calling this method.
If param ``locked`` is skipped, the current lock state of the repository is returned.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights, or that of a regular user with admin or write access to the 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>
make the password optional in API calls
r3809 result : {
locking API returns objects instead of string messages....
r3808 "repo": "<reponame>",
"locked": "<bool true|false>",
"locked_since": "<float lock_time>",
"locked_by": "<username>",
"msg": "User `<username>` set lock state for repo `<reponame>` to `<false|true>`"
make the password optional in API calls
r3809 }
added API call for locking/unlocking repositories
r2737 error : null
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 get_ip
------
added API method for checking IP
r3126
Mads Kiilerich
docs: improve the API documentation
r4879 Return IP address as seen from Kallithea server, together with all
added API method for checking IP
r3126 defined IP addresses for given user.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
added API method for checking IP
r3126
INPUT::
id : <id_for_response>
api_key : "<api_key>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "get_ip"
added API method for checking IP
r3126 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
--------
Mads Kiilerich
docs: improve the API documentation
r4879 Get a user by username or userid. The result is empty if user can't be found.
If userid param is skipped, it is set to id of user who is calling this method.
Any userid can be specified when the command is executed using the api_key of a user with admin rights.
Regular users can only speicy their own userid.
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
---------
Mads Kiilerich
docs: improve the API documentation
r4879 List all existing users.
This command can only be executed using the api_key of a user 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>"
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>",
Ton Plomp
api.rst edited online with Bitbucket...
r3940 "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>",
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
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 .. _create-user:
Nicolas VINOT
[API] Update doc
r1592 create_user
-----------
Mads Kiilerich
docs: improve the API documentation
r4879 Create new user.
This command can only be executed using the api_key of a user 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>"
method : "create_user"
args : {
"username" : "<username>",
return proper id from users_group...
r2531 "email" : "<useremail>",
make the password optional in API calls
r3809 "password" : "<password = Optional(None)>",
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
Søren Løvborg
docs: spelling, grammar, content and typography
r5425 Example::
kallithea-api create_user username:bent email:bent@example.com firstname:Bent lastname:Bentsen extern_type:ldap extern_name:uid=bent,dc=example,dc=com
API added explicit method for updating user account
r2002 update_user
-----------
Mads Kiilerich
docs: improve the API documentation
r4879 Update the given user if such user exists.
This command can only be executed using the api_key of a user with admin rights.
API added explicit method for updating user account
r2002
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>",
Ton Plomp
api.rst edited online with Bitbucket...
r3940 "api_key" : "<api_key>",
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
-----------
Michael V. DePalatis
docs: English and consistency corrections
r4955 Delete the given user if such a user exists.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
API, added delete_user method....
r2365
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
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 get_user_group
--------------
Nicolas VINOT
[API] Update doc
r1592
Mads Kiilerich
docs: improve the API documentation
r4879 Get an existing user group.
This command can only be executed using the api_key of a user 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>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "get_user_group"
Nicolas VINOT
[API] Update doc
r1592 args : {
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 "usergroupid" : "<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>",
Ton Plomp
api.rst edited online with Bitbucket...
r3940 "api_key" : "<api_key>",
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
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 get_user_groups
---------------
api review...
r1843
Mads Kiilerich
docs: improve the API documentation
r4879 List all existing user groups.
This command can only be executed using the api_key of a user with admin rights.
api review...
r1843
INPUT::
API docs improvement....
r2143 id : <id_for_response>
api review...
r1843 api_key : "<api_key>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "get_user_groups"
api review...
r1843 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
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 create_user_group
-----------------
Extended API...
r1500
Mads Kiilerich
docs: improve the API documentation
r4879 Create a new user group.
This command can only be executed using the api_key of a user with admin rights.
Extended API...
r1500
INPUT::
API docs improvement....
r2143 id : <id_for_response>
Nicolas VINOT
[API] Update doc
r1592 api_key : "<api_key>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "create_user_group"
Nicolas VINOT
[API] Update doc
r1592 args: {
- Manage User’s Groups: create, delete, rename, add/remove users inside....
r3714 "group_name": "<groupname>",
Mads Kiilerich
docs: add documentation for update_repo API
r5274 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
- Manage User’s Groups: create, delete, rename, add/remove users inside....
r3714 "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
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 add_user_to_user_group
----------------------
Nicolas VINOT
[API] Update doc
r1592
Michael V. DePalatis
docs: English and consistency corrections
r4955 Adds a user to a user group. If the user already is in that group, success will be
``false``.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user 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>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "add_user_user_group"
Nicolas VINOT
[API] Update doc
r1592 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
docs: improve the API documentation
r4879 "msg": "added member `<username>` to a user group `<groupname>` |
API changes...
r1989 User is already in that group"
}
error: null
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 remove_user_from_user_group
---------------------------
API changes...
r1989
Mads Kiilerich
docs: improve the API documentation
r4879 Remove a user from a user group. If the user isn't in the given group, success will
Michael V. DePalatis
docs: English and consistency corrections
r4955 be ``false``.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
API changes...
r1989
INPUT::
API docs improvement....
r2143 id : <id_for_response>
API changes...
r1989 api_key : "<api_key>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "remove_user_from_user_group"
API changes...
r1989 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
api review...
r1843 get_repo
--------
Mads Kiilerich
docs: improve the API documentation
r4879 Get an existing repository by its name or repository_id. Members will contain
Michael V. DePalatis
docs: English and consistency corrections
r4955 either users_group or users associated to that repository.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights,
or that of a regular user with at least read access to the repository.
#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>",
Ton Plomp
api.rst edited online with Bitbucket...
r3940 "api_key" : "<api_key>",
added last_changeset information in get_repo API function
r3174 "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>",
Ton Plomp
api.rst edited online with Bitbucket...
r3940 "api_key" : "<api_key>",
updated api docs
r3213 "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
Nicolas VINOT
[API] Update doc
r1592 get_repos
---------
Mads Kiilerich
docs: improve the API documentation
r4879 List all existing repositories.
This command can only be executed using the api_key of a user with admin rights,
or that of a regular user with at least read access to the repository.
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>",
Mads Kiilerich
docs: add documentation for update_repo API
r5274 "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
--------------
Mads Kiilerich
docs: improve the API documentation
r4879 Return a list of files and directories for a given path at the given revision.
Michael V. DePalatis
docs: English and consistency corrections
r4955 It is possible to specify ret_type to show only ``files`` or ``dirs``.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
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
-----------
Michael V. DePalatis
docs: English and consistency corrections
r4955 Create a repository. If the repository name contains "/", all needed repository
Mads Kiilerich
docs: improve the API documentation
r4879 groups will be created. For example "foo/bar/baz" will create repository groups
whitespace cleanup
r3224 "foo", "bar" (with "foo" as parent), and create "baz" repository with
Mads Kiilerich
docs: improve the API documentation
r4879 "bar" as group.
This command can only be executed using the api_key of a user with admin rights,
or that of a regular user with create repository permission.
Regular users cannot specify owner parameter.
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>",
Mads Kiilerich
docs: add documentation for update_repo API
r5274 "owner" : "<owner_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>",
Mads Kiilerich
docs: add documentation for update_repo API
r5274 "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
Mads Kiilerich
docs: add documentation for update_repo API
r5274 update_repo
-----------
Update a repository.
This command can only be executed using the api_key of a user with admin rights,
or that of a regular user with create repository permission.
Regular users cannot specify owner parameter.
INPUT::
id : <id_for_response>
api_key : "<api_key>"
method : "update_repo"
args: {
"repoid" : "<reponame or repo_id>"
"name" : "<reponame> = Optional('')",
"group" : "<group_id> = Optional(None)",
"owner" : "<owner_name_or_id = Optional(=apiuser)>",
"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)",
}
OUTPUT::
id : <id_given_in_input>
result: {
"msg": "updated repo ID:repo_id `<reponame>`",
"repository": {
"repo_id" : "<repo_id>",
"repo_name" : "<reponame>"
"repo_type" : "<repo_type>",
"clone_uri" : "<clone_uri>",
"private": "<bool>",
"created_on" : "<datetimecreated>",
"description" : "<description>",
"landing_rev": "<landing_rev>",
"owner": "<username or user_id>",
"fork_of": "<name_of_fork_parent>",
"enable_downloads": "<bool>",
"enable_locking": "<bool>",
"enable_statistics": "<bool>",
"last_changeset": {
"author": "<full_author>",
"date": "<date_time_of_commit>",
"message": "<commit_message>",
"raw_id": "<raw_id>",
"revision": "<numeric_revision>",
"short_id": "<short_id>"
}
"locked_by": "<username>",
"locked_date": "<float lock_time>",
},
}
error: null
#699: fix missing fork docs for API
r3122 fork_repo
---------
Michael V. DePalatis
docs: English and consistency corrections
r4955 Create a fork of the given repo. If using Celery, this will
return success message immediately and a fork will be created
Mads Kiilerich
docs: improve the API documentation
r4879 asynchronously.
Mads Kiilerich
api: check repo create permissions for update_repo and fork_repo as for create-repo...
r5222 This command can only be executed using the api_key of a user with admin
rights, or with the global fork permission, by a regular user with create
repository permission and at least read access to the repository.
Mads Kiilerich
docs: improve the API documentation
r4879 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
-----------
Mads Kiilerich
docs: improve the API documentation
r4879 Delete a repository.
This command can only be executed using the api_key of a user with admin rights,
or that of a regular user with admin access to the repository.
Michael V. DePalatis
docs: English and consistency corrections
r4955 When ``forks`` param is set it is possible to detach or delete forks of the deleted 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: {
recursive forks detach...
r3641 "repoid" : "<reponame or repo_id>",
"forks" : "`delete` or `detach` = Optional(None)"
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
Michael V. DePalatis
docs: English and consistency corrections
r4955 Grant permission for a user on the given repository, or update the existing one if found.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a 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>"
#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
----------------------
Michael V. DePalatis
docs: English and consistency corrections
r4955 Revoke permission for a user on the given repository.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
#227 Initial version of repository groups permissions system...
r1982
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
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 grant_user_group_permission
---------------------------
implements #329...
r1793
Michael V. DePalatis
docs: English and consistency corrections
r4955 Grant permission for a user group on the given repository, or update the
Mads Kiilerich
docs: improve the API documentation
r4879 existing one if found.
This command can only be executed using the api_key of a user with admin rights.
#227 Initial version of repository groups permissions system...
r1982
implements #329...
r1793 INPUT::
API docs improvement....
r2143 id : <id_for_response>
implements #329...
r1793 api_key : "<api_key>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "grant_user_group_permission"
#227 Initial version of repository groups permissions system...
r1982 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
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 revoke_user_group_permission
----------------------------
#227 Initial version of repository groups permissions system...
r1982
Michael V. DePalatis
docs: English and consistency corrections
r4955 Revoke permission for a user group on the given repository.
Mads Kiilerich
docs: improve the API documentation
r4879 This command can only be executed using the api_key of a user with admin rights.
#227 Initial version of repository groups permissions system...
r1982
INPUT::
API docs improvement....
r2143 id : <id_for_response>
#227 Initial version of repository groups permissions system...
r1982 api_key : "<api_key>"
Rasmus Selsmark
Corrected method names in documentation, to match API
r4493 method : "revoke_user_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