api.rst
845 lines
| 22.7 KiB
| text/x-rst
|
RstLexer
r1446 | .. _api: | ||
r2095 | === | ||
r1446 | API | ||
=== | |||
Starting from RhodeCode version 1.2 a simple API was implemented. | |||
r1500 | There's a single schema for calling all api methods. API is implemented | ||
r2531 | with JSON protocol both ways. An url to send API request to RhodeCode is | ||
r1500 | <your_server>/_admin/api | ||
r1446 | |||
r1839 | API ACCESS FOR WEB VIEWS | ||
++++++++++++++++++++++++ | |||
r1446 | |||
r1911 | 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 | |||
GET parameter `?api_key=<api_key>` to url. By default this is only | |||
r1812 | enabled on RSS/ATOM feed views. | ||
r1839 | API ACCESS | ||
++++++++++ | |||
r1708 | All clients are required to send JSON-RPC spec JSON data:: | ||
r1446 | |||
r1708 | { | ||
r2143 | "id:"<id>", | ||
r1446 | "api_key":"<api_key>", | ||
"method":"<method_name>", | |||
"args":{"<arg_key>":"<arg_val>"} | |||
} | |||
r1500 | Example call for autopulling remotes repos using curl:: | ||
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"}}' | ||
r1500 | |||
Nicolas VINOT
|
r1592 | Simply provide | |
r1708 | - *id* A value of any type, which is used to match the response with the request that it is replying to. | ||
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
|
r1592 | ||
r1446 | .. note:: | ||
Nicolas VINOT
|
r1592 | ||
api_key can be found in your user account page | |||
r1708 | RhodeCode API will return always a JSON-RPC response:: | ||
Nicolas VINOT
|
r1592 | ||
r1708 | { | ||
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) | |||
r1446 | } | ||
All responses from API will be `HTTP/1.0 200 OK`, if there's an error while | |||
Nicolas VINOT
|
r1592 | calling api *error* key from response will contain failure description | |
r1446 | and result will be null. | ||
r2379 | |||
API CLIENT | |||
++++++++++ | |||
r2531 | From version 1.4 RhodeCode adds a script that allows to easily | ||
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> | |||
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:: | |||
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:: | |||
rhodecode-api get_repo repoid:rhodecode | |||
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...>} | |||
r1446 | API METHODS | ||
+++++++++++ | |||
Nicolas VINOT
|
r1592 | ||
r1446 | pull | ||
---- | |||
Nicolas VINOT
|
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 | |||
r1500 | belonging to user with admin rights | ||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "pull" | |||
args : { | |||
r2531 | "repoid" : "<reponame or repo_id>" | ||
Nicolas VINOT
|
r1592 | } | |
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
result : "Pulled from `<reponame>`" | |||
Nicolas VINOT
|
r1592 | error : null | |
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. | |||
This command can be executed only using api_key belonging to user with admin | |||
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> | |||
result : "{'added': [<list of names of added repos>], | |||
'removed': [<list of names of removed repos>]}" | |||
error : null | |||
r2737 | lock | ||
---- | |||
Set locking state on given repository by given user. | |||
This command can be executed only using api_key belonging to user with admin | |||
rights. | |||
INPUT:: | |||
id : <id_for_response> | |||
api_key : "<api_key>" | |||
method : "lock" | |||
args : { | |||
"repoid" : "<reponame or repo_id>" | |||
"userid" : "<user_id or username>", | |||
"locked" : "<bool true|false>" | |||
} | |||
OUTPUT:: | |||
id : <id_given_in_input> | |||
result : "User `<username>` set lock state for repo `<reponame>` to `true|false`" | |||
error : null | |||
r1843 | get_user | ||
-------- | |||
r2010 | Get's an user by username or user_id, Returns empty result if user is not found. | ||
r1843 | This command can be executed only using api_key belonging to user with admin | ||
rights. | |||
r1982 | |||
r1843 | INPUT:: | ||
r2143 | id : <id_for_response> | ||
r1843 | api_key : "<api_key>" | ||
method : "get_user" | |||
args : { | |||
r2010 | "userid" : "<username or user_id>" | ||
r1843 | } | ||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1843 | result: None if user does not exist or | ||
{ | |||
r2531 | "user_id" : "<user_id>", | ||
r1843 | "username" : "<username>", | ||
"firstname": "<firstname>", | |||
"lastname" : "<lastname>", | |||
"email" : "<email>", | |||
r2506 | "emails": "<list_of_all_additional_emails>", | ||
r1843 | "active" : "<bool>", | ||
"admin" :Â "<bool>", | |||
r2151 | "ldap_dn" : "<ldap_dn>", | ||
"last_login": "<last_login>", | |||
"permissions": { | |||
"global": ["hg.create.repository", | |||
"repository.read", | |||
"hg.register.manual_activate"], | |||
"repositories": {"repo1": "repository.none"}, | |||
"repositories_groups": {"Group1": "group.read"} | |||
}, | |||
r1843 | } | ||
error: null | |||
Nicolas VINOT
|
r1592 | get_users | |
--------- | |||
Lists all existing users. This command can be executed only using api_key | |||
belonging to user with admin rights. | |||
r1982 | |||
Nicolas VINOT
|
r1592 | INPUT:: | |
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "get_users" | |||
args : { } | |||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
Nicolas VINOT
|
r1592 | result: [ | |
{ | |||
r2531 | "user_id" : "<user_id>", | ||
Nicolas VINOT
|
r1592 | "username" : "<username>", | |
"firstname": "<firstname>", | |||
"lastname" : "<lastname>", | |||
"email" : "<email>", | |||
r2531 | "emails": "<list_of_all_additional_emails>", | ||
Nicolas VINOT
|
r1592 | "active" : "<bool>", | |
"admin" :Â "<bool>", | |||
r2151 | "ldap_dn" : "<ldap_dn>", | ||
"last_login": "<last_login>", | |||
Nicolas VINOT
|
r1592 | }, | |
… | |||
] | |||
error: null | |||
r1982 | |||
Nicolas VINOT
|
r1592 | create_user | |
----------- | |||
r2002 | Creates new user. This command can | ||
r1909 | be executed only using api_key belonging to user with admin rights. | ||
Nicolas VINOT
|
r1592 | ||
r1982 | |||
Nicolas VINOT
|
r1592 | INPUT:: | |
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "create_user" | |||
args : { | |||
"username" : "<username>", | |||
r2531 | "email" : "<useremail>", | ||
Nicolas VINOT
|
r1592 | "password" : "<password>", | |
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
|
r1592 | } | |
r1500 | |||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
Nicolas VINOT
|
r1592 | result: { | |
r2531 | "msg" : "created new user `<username>`", | ||
r2365 | "user": { | ||
r2531 | "user_id" : "<user_id>", | ||
r2365 | "username" : "<username>", | ||
"firstname": "<firstname>", | |||
"lastname" : "<lastname>", | |||
"email" : "<email>", | |||
r2531 | "emails": "<list_of_all_additional_emails>", | ||
r2365 | "active" : "<bool>", | ||
"admin" :Â "<bool>", | |||
"ldap_dn" : "<ldap_dn>", | |||
"last_login": "<last_login>", | |||
}, | |||
Nicolas VINOT
|
r1592 | } | |
error: null | |||
r1982 | |||
r2002 | update_user | ||
----------- | |||
r2365 | updates given user if such user exists. This command can | ||
r2002 | be executed only using api_key belonging to user with admin rights. | ||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
r2002 | api_key : "<api_key>" | ||
method : "update_user" | |||
args : { | |||
r2009 | "userid" : "<user_id or username>", | ||
r2531 | "username" : "<username> = Optional", | ||
"email" : "<useremail> = Optional", | |||
"password" : "<password> = Optional", | |||
"firstname" : "<firstname> = Optional", | |||
"lastname" : "<lastname> = Optional", | |||
"active" : "<bool> = Optional", | |||
"admin" : "<bool> = Optional", | |||
"ldap_dn" : "<ldap_dn> = Optional" | |||
r2002 | } | ||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r2002 | result: { | ||
r2507 | "msg" : "updated user ID:<userid> <username>", | ||
"user": { | |||
r2531 | "user_id" : "<user_id>", | ||
r2507 | "username" : "<username>", | ||
"firstname": "<firstname>", | |||
"lastname" : "<lastname>", | |||
"email" : "<email>", | |||
r2531 | "emails": "<list_of_all_additional_emails>", | ||
r2507 | "active" : "<bool>", | ||
"admin" :Â "<bool>", | |||
"ldap_dn" : "<ldap_dn>", | |||
"last_login": "<last_login>", | |||
}, | |||
r2365 | } | ||
error: null | |||
delete_user | |||
----------- | |||
deletes givenuser if such user exists. This command can | |||
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:: | |||
r2531 | id : <id_given_in_input> | ||
r2365 | result: { | ||
r2531 | "msg" : "deleted user ID:<userid> <username>", | ||
"user": null | |||
r2002 | } | ||
error: null | |||
Nicolas VINOT
|
r1592 | get_users_group | |
--------------- | |||
Gets an existing users group. This command can be executed only using api_key | |||
belonging to user with admin rights. | |||
r1982 | |||
Nicolas VINOT
|
r1592 | INPUT:: | |
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "get_users_group" | |||
args : { | |||
r2531 | "usersgroupid" : "<users group id or name>" | ||
Nicolas VINOT
|
r1592 | } | |
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
Nicolas VINOT
|
r1592 | result : None if group not exist | |
{ | |||
r2531 | "users_group_id" : "<id>", | ||
"group_name" : "<groupname>", | |||
"active": "<bool>", | |||
Nicolas VINOT
|
r1592 | "members" : [ | |
r2531 | { | ||
"user_id" : "<user_id>", | |||
r1843 | "username" : "<username>", | ||
"firstname": "<firstname>", | |||
"lastname" : "<lastname>", | |||
"email" : "<email>", | |||
r2531 | "emails": "<list_of_all_additional_emails>", | ||
r1843 | "active" : "<bool>", | ||
"admin" :Â "<bool>", | |||
r2531 | "ldap_dn" : "<ldap_dn>", | ||
"last_login": "<last_login>", | |||
r1843 | }, | ||
… | |||
] | |||
Nicolas VINOT
|
r1592 | } | |
error : null | |||
r1982 | |||
r1843 | get_users_groups | ||
---------------- | |||
Lists all existing users groups. This command can be executed only using | |||
api_key belonging to user with admin rights. | |||
r1982 | |||
r1843 | INPUT:: | ||
r2143 | id : <id_for_response> | ||
r1843 | api_key : "<api_key>" | ||
method : "get_users_groups" | |||
args : { } | |||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1843 | result : [ | ||
{ | |||
r2531 | "users_group_id" : "<id>", | ||
"group_name" : "<groupname>", | |||
"active": "<bool>", | |||
}, | |||
… | |||
r1843 | ] | ||
error : null | |||
r1500 | create_users_group | ||
------------------ | |||
Nicolas VINOT
|
r1592 | Creates new users group. This command can be executed only using api_key | |
r1500 | belonging to user with admin rights | ||
r1982 | |||
r1500 | INPUT:: | ||
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "create_users_group" | |||
args: { | |||
r1843 | "group_name": "<groupname>", | ||
r2531 | "active":"<bool> = Optional(True)" | ||
Nicolas VINOT
|
r1592 | } | |
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
Nicolas VINOT
|
r1592 | result: { | |
r2531 | "msg": "created new users group `<groupname>`", | ||
"users_group": { | |||
"users_group_id" : "<id>", | |||
"group_name" : "<groupname>", | |||
"active": "<bool>", | |||
}, | |||
Nicolas VINOT
|
r1592 | } | |
error: null | |||
r1982 | |||
r1793 | add_user_to_users_group | ||
----------------------- | |||
Nicolas VINOT
|
r1592 | ||
r1989 | Adds a user to a users group. If user exists in that group success will be | ||
`false`. This command can be executed only using api_key | |||
Nicolas VINOT
|
r1592 | belonging to user with admin rights | |
r1982 | |||
Nicolas VINOT
|
r1592 | INPUT:: | |
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "add_user_users_group" | |||
args: { | |||
r2531 | "usersgroupid" : "<users group id or name>", | ||
"userid" : "<user_id or username>", | |||
Nicolas VINOT
|
r1592 | } | |
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
Nicolas VINOT
|
r1592 | result: { | |
r1989 | "success": True|False # depends on if member is in group | ||
r2531 | "msg": "added member `<username>` to users group `<groupname>` | | ||
r1989 | User is already in that group" | ||
} | |||
error: null | |||
remove_user_from_users_group | |||
---------------------------- | |||
Removes a user from a users group. If user is not in given group success will | |||
be `false`. This command can be executed only | |||
using api_key belonging to user with admin rights | |||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
r1989 | api_key : "<api_key>" | ||
method : "remove_user_from_users_group" | |||
args: { | |||
r2531 | "usersgroupid" : "<users group id or name>", | ||
"userid" : "<user_id or username>", | |||
r1989 | } | ||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1989 | result: { | ||
"success": True|False, # depends on if member is in group | |||
"msg": "removed member <username> from users group <groupname> | | |||
User wasn't in group" | |||
Nicolas VINOT
|
r1592 | } | |
error: null | |||
r1982 | |||
r1843 | get_repo | ||
-------- | |||
r2146 | Gets an existing repository by it's name or repository_id. Members will return | ||
either users_group or user associated to that repository. This command can | |||
r2010 | be executed only using api_key belonging to user with admin rights. | ||
r1843 | |||
r1982 | |||
r1843 | INPUT:: | ||
r2143 | id : <id_for_response> | ||
r1843 | api_key : "<api_key>" | ||
method : "get_repo" | |||
args: { | |||
r2010 | "repoid" : "<reponame or repo_id>" | ||
r1843 | } | ||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1843 | result: None if repository does not exist or | ||
{ | |||
r2531 | "repo_id" : "<repo_id>", | ||
r1843 | "repo_name" : "<reponame>" | ||
r2531 | "repo_type" : "<repo_type>", | ||
r2338 | "clone_uri" : "<clone_uri>", | ||
"private": : "<bool>", | |||
r2531 | "created_on" : "<datetimecreated>", | ||
"description" : "<description>", | |||
"landing_rev": "<landing_rev>", | |||
"owner": "<repo_owner>", | |||
"fork_of": "<name_of_fork_parent>", | |||
r1843 | "members" : [ | ||
r2146 | { | ||
"type": "user", | |||
r2531 | "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>", | |||
r1843 | "permission" : "repository.(read|write|admin)" | ||
}, | |||
… | |||
r2146 | { | ||
"type": "users_group", | |||
r1843 | "id" : "<usersgroupid>", | ||
"name" : "<usersgroupname>", | |||
"active": "<bool>", | |||
"permission" : "repository.(read|write|admin)" | |||
}, | |||
… | |||
] | |||
} | |||
error: null | |||
r1982 | |||
Nicolas VINOT
|
r1592 | get_repos | |
--------- | |||
Lists all existing repositories. This command can be executed only using api_key | |||
belonging to user with admin rights | |||
r1982 | |||
Nicolas VINOT
|
r1592 | INPUT:: | |
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "get_repos" | |||
args: { } | |||
r1500 | |||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
Nicolas VINOT
|
r1592 | result: [ | |
{ | |||
r2531 | "repo_id" : "<repo_id>", | ||
r1843 | "repo_name" : "<reponame>" | ||
r2531 | "repo_type" : "<repo_type>", | ||
r2338 | "clone_uri" : "<clone_uri>", | ||
"private": : "<bool>", | |||
r2531 | "created_on" : "<datetimecreated>", | ||
"description" : "<description>", | |||
"landing_rev": "<landing_rev>", | |||
"owner": "<repo_owner>", | |||
"fork_of": "<name_of_fork_parent>", | |||
Nicolas VINOT
|
r1592 | }, | |
… | |||
] | |||
error: null | |||
r1810 | get_repo_nodes | ||
-------------- | |||
returns a list of nodes and it's children in a flat list for a given path | |||
r1843 | 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 | |||
r1810 | with admin rights | ||
r1982 | |||
r1810 | INPUT:: | ||
r2143 | id : <id_for_response> | ||
r1810 | api_key : "<api_key>" | ||
method : "get_repo_nodes" | |||
args: { | |||
r2531 | "repoid" : "<reponame or repo_id>" | ||
r1810 | "revision" : "<revision>", | ||
"root_path" : "<root_path>", | |||
r2531 | "ret_type" : "<ret_type> = Optional('all')" | ||
r1810 | } | ||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1810 | result: [ | ||
{ | |||
"name" : "<name>" | |||
"type" : "<type>", | |||
}, | |||
… | |||
] | |||
error: null | |||
Nicolas VINOT
|
r1592 | create_repo | |
----------- | |||
Creates a repository. This command can be executed only using api_key | |||
belonging to user with admin rights. | |||
If repository name contains "/", all needed repository 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. | |||
r1982 | |||
Nicolas VINOT
|
r1592 | INPUT:: | |
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
method : "create_repo" | |||
args: { | |||
r1843 | "repo_name" : "<reponame>", | ||
r2531 | "owner" : "<onwer_name_or_id>", | ||
"repo_type" : "<repo_type>", | |||
"description" : "<description> = Optional('')", | |||
"private" : "<bool> = Optional(False)", | |||
"clone_uri" : "<clone_uri> = Optional(None)", | |||
"landing_rev" : "<landing_rev> = Optional('tip')", | |||
Nicolas VINOT
|
r1592 | } | |
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1843 | result: { | ||
r2531 | "msg": "Created new repository `<reponame>`", | ||
r2378 | "repo": { | ||
r2531 | "repo_id" : "<repo_id>", | ||
r2378 | "repo_name" : "<reponame>" | ||
r2531 | "repo_type" : "<repo_type>", | ||
r2378 | "clone_uri" : "<clone_uri>", | ||
"private": : "<bool>", | |||
r2531 | "created_on" : "<datetimecreated>", | ||
"description" : "<description>", | |||
"landing_rev": "<landing_rev>", | |||
"owner": "<repo_owner>", | |||
"fork_of": "<name_of_fork_parent>", | |||
r2378 | }, | ||
r1843 | } | ||
Nicolas VINOT
|
r1592 | error: null | |
r1982 | |||
r2003 | delete_repo | ||
----------- | |||
Deletes a repository. This command can be executed only using api_key | |||
belonging to user with admin rights. | |||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
r2003 | api_key : "<api_key>" | ||
method : "delete_repo" | |||
args: { | |||
r2531 | "repoid" : "<reponame or repo_id>" | ||
r2003 | } | ||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r2003 | result: { | ||
r2531 | "msg": "Deleted repository `<reponame>`", | ||
"success": true | |||
r2003 | } | ||
error: null | |||
r1982 | grant_user_permission | ||
--------------------- | |||
Nicolas VINOT
|
r1592 | ||
r1982 | Grant permission for user on given repository, or update existing one | ||
if found. This command can be executed only using api_key belonging to user | |||
with admin rights. | |||
Nicolas VINOT
|
r1592 | ||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
Nicolas VINOT
|
r1592 | api_key : "<api_key>" | |
r1982 | method : "grant_user_permission" | ||
Nicolas VINOT
|
r1592 | args: { | |
r2531 | "repoid" : "<reponame or repo_id>" | ||
"userid" : "<username or user_id>" | |||
r1982 | "perm" : "(repository.(none|read|write|admin))", | ||
} | |||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1982 | result: { | ||
r2531 | "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`", | ||
"success": true | |||
r1982 | } | ||
error: null | |||
revoke_user_permission | |||
---------------------- | |||
Revoke permission for user on given repository. This command can be executed | |||
only using api_key belonging to user with admin rights. | |||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
r1982 | api_key : "<api_key>" | ||
method : "revoke_user_permission" | |||
args: { | |||
r2531 | "repoid" : "<reponame or repo_id>" | ||
"userid" : "<username or user_id>" | |||
Nicolas VINOT
|
r1592 | } | |
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1843 | result: { | ||
r2531 | "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`", | ||
"success": true | |||
r1843 | } | ||
Nicolas VINOT
|
r1592 | error: null | |
r1793 | |||
r1982 | |||
grant_users_group_permission | |||
---------------------------- | |||
r1793 | |||
r1982 | Grant permission for users group on given repository, or update | ||
existing one if found. This command can be executed only using | |||
api_key belonging to user with admin rights. | |||
r1793 | |||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
r1793 | api_key : "<api_key>" | ||
r1982 | method : "grant_users_group_permission" | ||
args: { | |||
r2531 | "repoid" : "<reponame or repo_id>" | ||
"usersgroupid" : "<users group id or name>" | |||
r1982 | "perm" : "(repository.(none|read|write|admin))", | ||
} | |||
OUTPUT:: | |||
r2531 | id : <id_given_in_input> | ||
r1982 | result: { | ||
r2531 | "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", | ||
"success": true | |||
r1982 | } | ||
error: null | |||
revoke_users_group_permission | |||
----------------------------- | |||
Revoke permission for users group on given repository.This command can be | |||
executed only using api_key belonging to user with admin rights. | |||
INPUT:: | |||
r2143 | id : <id_for_response> | ||
r1982 | api_key : "<api_key>" | ||
method : "revoke_users_group_permission" | |||
r1793 | args: { | ||
r2531 | "repoid" : "<reponame or repo_id>" | ||
"usersgroupid" : "<users group id or name>" | |||
r1843 | } | ||
r1982 | |||
r1843 | OUTPUT:: | ||
r1982 | |||
r2531 | id : <id_given_in_input> | ||
r1843 | result: { | ||
r2531 | "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`", | ||
"success": true | |||
r1843 | } | ||
r1982 | error: null |