Skip to content

api

Builtin routes API.

This module also provides the API object to be used by third-party api developers to define new apis

Attributes

mlogger = get_logger(__name__) module-attribute

routes_api = routes.API('routes') module-attribute

Functions

get_status()

Get server status.

Source code in pyrevitlib/pyrevit/routes/api.py
@routes_api.route('/status', methods=['GET'])
def get_status():
    """Get server status."""
    return {
        "host": HOST_APP.pretty_name,
        "username": HOST_APP.username,
        "session_id": sessioninfo.get_session_uuid(),
        }

get_sisters()

Get other servers running on the same machine.

Source code in pyrevitlib/pyrevit/routes/api.py
@routes_api.route('/sisters', methods=['GET'])
def get_sisters():
    """Get other servers running on the same machine."""
    return [x.get_cache_data() for x in serverinfo.get_registered_servers()]

get_sisters_by_year(version)

Get servers of specific version, running on the same machine.

Source code in pyrevitlib/pyrevit/routes/api.py
@routes_api.route('/sisters/<int:version>', methods=['GET'])
def get_sisters_by_year(version):
    """Get servers of specific version, running on the same machine."""
    return [x.get_cache_data() for x in serverinfo.get_registered_servers()
            if int(x.version) == version]