Mercurial > public > src > rhodecode
diff docs/api/api.rst @ 1793:fee9895fa46e beta
changed API to match fully JSON-RPC specs
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 21 Nov 2011 03:08:09 +0200 |
parents | 8628c8706bf8 |
children | 631caf880b87 |
line wrap: on
line diff
--- a/docs/api/api.rst Mon Nov 21 02:53:17 2011 +0200 +++ b/docs/api/api.rst Mon Nov 21 03:08:09 2011 +0200 @@ -11,18 +11,20 @@ <your_server>/_admin/api -All clients need to send JSON data in such format:: +All clients are required to send JSON-RPC spec JSON data:: - { + { + "id:<id>, "api_key":"<api_key>", "method":"<method_name>", "args":{"<arg_key>":"<arg_val>"} } Example call for autopulling remotes repos using curl:: - curl https://server.com/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}' + 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"}}' Simply provide + - *id* A value of any type, which is used to match the response with the request that it is replying to. - *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 @@ -32,9 +34,10 @@ api_key can be found in your user account page -RhodeCode API will return always a JSON formatted answer:: +RhodeCode API will return always a JSON-RPC response:: - { + { + "id":<id>, "result": "<result>", "error": null }