Changeset - 320dec24fb9a
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-12-28 22:57:57
marcin@python-works.com
Added instruction on enabling the API access to web views
1 file changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
docs/api/api.rst
Show inline comments
 
@@ -2,24 +2,31 @@
 

	
 

	
 
API
 
===
 

	
 

	
 
Starting from RhodeCode version 1.2 a simple API was implemented.
 
There's a single schema for calling all api methods. API is implemented
 
with JSON protocol both ways. An url to send API request in RhodeCode is
 
<your_server>/_admin/api
 

	
 

	
 
API access can also be turned on for each view decorated with `@LoginRequired`
 
decorator. To enable API access simple change standard login decorator into
 
`@LoginRequired(api_access=True)`. After such a change view can be accessed
 
by adding a GET parameter to url `?api_key=<api_key>`. By default it's only
 
enabled on RSS/ATOM feed views.
 

	
 

	
 
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 '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}'
 

	
0 comments (0 inline, 0 general)