comparison docs/api/api.rst @ 5496:2b2216e8af36 stable

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.
author Søren Løvborg <sorenl@unity3d.com>
date Wed, 09 Sep 2015 18:32:05 +0200
parents 8867673c8192
children 12b47803189f
comparison
equal deleted inserted replaced
5495:222a9f3d4023 5496:2b2216e8af36
81 Kallithea comes with a ``kallithea-api`` command line tool, providing a convenient 81 Kallithea comes with a ``kallithea-api`` command line tool, providing a convenient
82 way to call the JSON-RPC API. 82 way to call the JSON-RPC API.
83 83
84 For example, to call ``get_repo``:: 84 For example, to call ``get_repo``::
85 85
86 kallithea-api --apihost=<your.kallithea.server.url> --apikey=<yourapikey> get_repo 86 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo
87 87
88 calling {"api_key": "<apikey>", "id": 75, "args": {}, "method": "get_repo"} to http://127.0.0.1:5000 88 Calling method get_repo => <Kallithea URL>
89 Kallithea said: 89 Server response
90 {'error': 'Missing non optional `repoid` arg in JSON DATA', 90 ERROR:"Missing non optional `repoid` arg in JSON DATA"
91 'id': 75,
92 'result': None}
93 91
94 Oops, looks like we forgot to add an argument. Let's try again, now 92 Oops, looks like we forgot to add an argument. Let's try again, now
95 providing the ``repoid`` as a parameter:: 93 providing the ``repoid`` as a parameter::
96 94
97 kallithea-api get_repo repoid:myrepo 95 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo repoid:myrepo
98 96
99 calling {"api_key": "<apikey>", "id": 39, "args": {"repoid": "myrepo"}, "method": "get_repo"} to http://127.0.0.1:5000 97 Calling method get_repo => <Kallithea URL>
100 Kallithea said: 98 Server response
101 {'error': None, 99 {
102 'id': 39, 100 "clone_uri": null,
103 'result': <json data...>} 101 "created_on": "2015-08-31T14:55:19.042",
102 ...
104 103
105 To avoid specifying ``apihost`` and ``apikey`` every time, run:: 104 To avoid specifying ``apihost`` and ``apikey`` every time, run::
106 105
107 kallithea-api --save-config --apihost=<your.kallithea.server.url> --apikey=<yourapikey> 106 kallithea-api --save-config --apihost=<Kallithea URL> --apikey=<API key>
108 107
109 This will create a ``~/.config/kallithea`` with the specified hostname and API key 108 This will create a ``~/.config/kallithea`` with the specified URL and API key
110 so you don't have to specify them every time. 109 so you don't have to specify them every time.
111 110
112 111
113 API methods 112 API methods
114 +++++++++++ 113 +++++++++++