server methods

cleanup_sessions

cleanup_sessions(apiuser, older_then=<Optional:60>)

Triggers a session cleanup action.

If the older_then option is set, only sessions that hasn’t been accessed in the given number of days will be removed.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • older_then (Optional(int)) – Deletes session that hasn’t been accessed in given number of days.

Example output:

id : <id_given_in_input>
result: {
  "backend": "<type of backend>",
  "sessions_removed": <number_of_removed_sessions>
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  'Error occurred during session cleanup'
}

get_ip

get_ip(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)

Displays the IP Address as seen from the RhodeCode Enterprise server.

  • This command displays the IP Address, as well as all the defined IP addresses for the specified user. If the userid is not set, the data returned is for the user calling the method.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from Authentication Token.
  • userid (Optional(str or int)) – Sets the userid for which associated IP Address data is returned.

Example output:

id : <id_given_in_input>
result : {
             "server_ip_addr": "<ip_from_clien>",
             "user_ips": [
                            {
                               "ip_addr": "<ip_with_mask>",
                               "ip_range": ["<start_ip>", "<end_ip>"],
                            },
                            ...
                         ]
}

get_method

get_method(apiuser, pattern=<Optional:'*'>)

Returns list of all available API methods. By default match pattern os “*” but any other pattern can be specified. eg comment will return all methods with comment inside them. If just single method is matched returned data will also include method specification

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • pattern (Optional("*")) – pattern to match method names against

Example output:

id : <id_given_in_input>
"result": [
  "changeset_comment",
  "comment_pull_request",
  "comment_commit"
]
error :  null
id : <id_given_in_input>
"result": [
  "comment_commit",
  {
    "apiuser": "<RequiredType>",
    "comment_type": "<Optional:u'note'>",
    "commit_id": "<RequiredType>",
    "message": "<RequiredType>",
    "repoid": "<RequiredType>",
    "request": "<RequiredType>",
    "resolves_comment_id": "<Optional:None>",
    "status": "<Optional:None>",
    "userid": "<Optional:<OptionalAttr:apiuser>>"
  }
]
error :  null

get_repo_store

get_repo_store(apiuser)

Returns the RhodeCode Enterprise repository storage information.

Parameters:apiuser (AuthUser) – This is filled automatically from the Authentication Token.

Example output:

id : <id_given_in_input>
result : {
  'modules': [<module name>,...]
  'py_version': <python version>,
  'platform': <platform type>,
  'rhodecode_version': <rhodecode version>
}
error :  null

get_server_info

get_server_info(apiuser)

Returns the RhodeCode Enterprise server information.

This includes the running version of RhodeCode Enterprise and all installed packages. This command takes the following options:

Parameters:apiuser (AuthUser) – This is filled automatically from the Authentication Token.

Example output:

id : <id_given_in_input>
result : {
  'modules': [<module name>,...]
  'py_version': <python version>,
  'platform': <platform type>,
  'rhodecode_version': <rhodecode version>
}
error :  null

rescan_repos

rescan_repos(apiuser, remove_obsolete=<Optional:False>)

Triggers a rescan of the specified repositories.

  • If the remove_obsolete option is set, it also deletes repositories that are found in the database but not on the file system, so called “clean zombies”.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • remove_obsolete (Optional(True | False)) – Deletes repositories from the database that are not found on the filesystem.

Example output:

id : <id_given_in_input>
result : {
  'added': [<added repository name>,...]
  'removed': [<removed repository name>,...]
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  'Error occurred during rescan repositories action'
}

store_exception

store_exception(apiuser, exc_data_json, prefix=<Optional:'rhodecode'>)

Stores sent exception inside the built-in exception tracker in RhodeCode Enterprise server.

This command can only be run using an Authentication Token with admin rights to the specified repository.

This command takes the following options:

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • exc_data_json (JSON data) – JSON data with exception e.g {“exc_traceback”: “Value 1 is not allowed”, “exc_type_name”: “ValueError”}
  • prefix (Optional("rhodecode")) – prefix for error type, e.g ‘rhodecode’, ‘vcsserver’, ‘rhodecode-tools’

Example output:

id : <id_given_in_input>
"result": {
  "exc_id": 139718459226384,
  "exc_url": "http://localhost:8080/_admin/settings/exceptions/139718459226384"
}
error :  null