diff --git a/docs/api/api.rst b/docs/api/api.rst --- a/docs/api/api.rst +++ b/docs/api/api.rst @@ -59,6 +59,47 @@ All responses from API will be `HTTP/1.0 calling api *error* key from response will contain failure description and result will be null. + +API CLIENT +++++++++++ + +From version 1.4 RhodeCode adds a binary script that allows to easily +communicate with API. After installing RhodeCode a `rhodecode-api` script +will be available. + +To get started quickly simply run:: + + rhodecode-api _create_config --apikey= --apihost= + +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": "", "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": "", "id": 39, "args": {"repoid": "rhodecode"}, "method": "get_repo"} to http://127.0.0.1:5000 + rhodecode said: + {'error': None, + 'id': 39, + 'result': } + + + API METHODS +++++++++++ @@ -187,7 +228,18 @@ OUTPUT:: result: { "id" : "", - "msg" : "created new user " + "msg" : "created new user ", + "user": { + "id" : "", + "username" : "", + "firstname": "", + "lastname" : "", + "email" : "", + "active" : "", + "admin" :  "", + "ldap_dn" : "", + "last_login": "", + }, } error: null @@ -195,7 +247,7 @@ OUTPUT:: update_user ----------- -updates current one if such user exists. This command can +updates given user if such user exists. This command can be executed only using api_key belonging to user with admin rights. @@ -220,7 +272,33 @@ OUTPUT:: result: { "id" : "", - "msg" : "updated user " + "msg" : "updated user ID: " + } + 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 : + api_key : "" + method : "delete_user" + args : { + "userid" : "", + } + +OUTPUT:: + + result: { + "id" : "", + "msg" : "deleted user ID: " } error: null @@ -534,6 +612,15 @@ OUTPUT:: result: { "id": "", "msg": "Created new repository ", + "repo": { + "id" : "", + "repo_name" : "" + "type" : "", + "description" : "", + "clone_uri" : "", + "private": : "", + "created_on" : "", + }, } error: null