Files
@ 54e84659cb3a
Branch filter:
Location: kallithea/docs/api/api.rst - annotation
54e84659cb3a
10.2 KiB
text/prs.fallenstein.rst
fixes for release 1.2.4
- docs updates
- requires.txt file
- changelog
- docs updates
- requires.txt file
- changelog
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf 256e729a94cd 8628c8706bf8 256e729a94cd eab0cf9ab8bf 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a 54e84659cb3a eab0cf9ab8bf 702e29ce1e9b eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 eab0cf9ab8bf 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 702e29ce1e9b 8628c8706bf8 eab0cf9ab8bf 8628c8706bf8 eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf 8628c8706bf8 eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf 8628c8706bf8 eab0cf9ab8bf eab0cf9ab8bf eab0cf9ab8bf 8628c8706bf8 8628c8706bf8 256e729a94cd 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 466292e57bfd 466292e57bfd 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 256e729a94cd 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 702e29ce1e9b 702e29ce1e9b 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 256e729a94cd 256e729a94cd 256e729a94cd 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 702e29ce1e9b 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 702e29ce1e9b 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 702e29ce1e9b 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 8628c8706bf8 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b 702e29ce1e9b | .. _api:
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 FOR WEB VIEWS
++++++++++++++++++++++++
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
enabled on RSS/ATOM feed views.
API ACCESS
++++++++++
All clients are required to send JSON-RPC spec JSON data::
{
"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"}}'
Simply provide
- *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
.. note::
api_key can be found in your user account page
RhodeCode API will return always a JSON-RPC response::
{
"result": "<result>",
"error": null
}
All responses from API will be `HTTP/1.0 200 OK`, if there's an error while
calling api *error* key from response will contain failure description
and result will be null.
API METHODS
+++++++++++
pull
----
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
belonging to user with admin rights
INPUT::
api_key : "<api_key>"
method : "pull"
args : {
"repo" : "<repo_name>"
}
OUTPUT::
result : "Pulled from <repo_name>"
error : null
get_users
---------
Lists all existing users. This command can be executed only using api_key
belonging to user with admin rights.
INPUT::
api_key : "<api_key>"
method : "get_users"
args : { }
OUTPUT::
result: [
{
"id" : "<id>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"active" : "<bool>",
"admin" : "<bool>",
"ldap" : "<ldap_dn>"
},
…
]
error: null
create_user
-----------
Creates new user or updates current one if such user exists. This command can
be executed only using api_key belonging to user with admin rights.
INPUT::
api_key : "<api_key>"
method : "create_user"
args : {
"username" : "<username>",
"password" : "<password>",
"firstname" : "<firstname>",
"lastname" : "<lastname>",
"email" : "<useremail>"
"active" : "<bool> = True",
"admin" : "<bool> = False",
"ldap_dn" : "<ldap_dn> = None"
}
OUTPUT::
result: {
"msg" : "created new user <username>"
}
error: null
get_users_groups
----------------
Lists all existing users groups. This command can be executed only using api_key
belonging to user with admin rights.
INPUT::
api_key : "<api_key>"
method : "get_users_groups"
args : { }
OUTPUT::
result : [
{
"id" : "<id>",
"name" : "<name>",
"active": "<bool>",
"members" : [
{
"id" : "<userid>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"active" : "<bool>",
"admin" : "<bool>",
"ldap" : "<ldap_dn>"
},
…
]
}
]
error : null
get_users_group
---------------
Gets an existing users group. This command can be executed only using api_key
belonging to user with admin rights.
INPUT::
api_key : "<api_key>"
method : "get_users_group"
args : {
"group_name" : "<name>"
}
OUTPUT::
result : None if group not exist
{
"id" : "<id>",
"name" : "<name>",
"active": "<bool>",
"members" : [
{ "id" : "<userid>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"active" : "<bool>",
"admin" : "<bool>",
"ldap" : "<ldap_dn>"
},
…
]
}
error : null
create_users_group
------------------
Creates new users group. This command can be executed only using api_key
belonging to user with admin rights
INPUT::
api_key : "<api_key>"
method : "create_users_group"
args: {
"name": "<name>",
"active":"<bool> = True"
}
OUTPUT::
result: {
"id": "<newusersgroupid>",
"msg": "created new users group <name>"
}
error: null
add_user_to_users_group
-----------------------
Adds a user to a users group. This command can be executed only using api_key
belonging to user with admin rights
INPUT::
api_key : "<api_key>"
method : "add_user_users_group"
args: {
"group_name" : "<groupname>",
"user_name" : "<username>"
}
OUTPUT::
result: {
"id": "<newusersgroupmemberid>",
"msg": "created new users group member"
}
error: null
get_repos
---------
Lists all existing repositories. This command can be executed only using api_key
belonging to user with admin rights
INPUT::
api_key : "<api_key>"
method : "get_repos"
args: { }
OUTPUT::
result: [
{
"id" : "<id>",
"name" : "<name>"
"type" : "<type>",
"description" : "<description>"
},
…
]
error: null
get_repo
--------
Gets an existing repository. This command can be executed only using api_key
belonging to user with admin rights
INPUT::
api_key : "<api_key>"
method : "get_repo"
args: {
"name" : "<name>"
}
OUTPUT::
result: None if repository not exist
{
"id" : "<id>",
"name" : "<name>"
"type" : "<type>",
"description" : "<description>",
"members" : [
{ "id" : "<userid>",
"username" : "<username>",
"firstname": "<firstname>",
"lastname" : "<lastname>",
"email" : "<email>",
"active" : "<bool>",
"admin" : "<bool>",
"ldap" : "<ldap_dn>",
"permission" : "repository.(read|write|admin)"
},
…
{
"id" : "<usersgroupid>",
"name" : "<usersgroupname>",
"active": "<bool>",
"permission" : "repository.(read|write|admin)"
},
…
]
}
error: null
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.
INPUT::
api_key : "<api_key>"
method : "create_repo"
args: {
"name" : "<name>",
"owner_name" : "<ownername>",
"description" : "<description> = ''",
"repo_type" : "<type> = 'hg'",
"private" : "<bool> = False"
}
OUTPUT::
result: None
error: null
add_user_to_repo
----------------
Add a user to a repository. This command can be executed only using api_key
belonging to user with admin rights.
If "perm" is None, user will be removed from the repository.
INPUT::
api_key : "<api_key>"
method : "add_user_to_repo"
args: {
"repo_name" : "<reponame>",
"user_name" : "<username>",
"perm" : "(None|repository.(read|write|admin))",
}
OUTPUT::
result: None
error: null
add_users_group_to_repo
-----------------------
Add a users group to a repository. This command can be executed only using
api_key belonging to user with admin rights. If "perm" is None, group will
be removed from the repository.
INPUT::
api_key : "<api_key>"
method : "add_users_group_to_repo"
args: {
"repo_name" : "<reponame>",
"group_name" : "<groupname>",
"perm" : "(None|repository.(read|write|admin))",
}
|