{% extends "layouts/content.html" %} {% load i18n %} {% block title %} {{ block.super }} | {% trans "XML-RPC" %} {% endblock %} {% block breadcrumbs %} {{ block.super }}
  • {% trans "LAVA" %}
  • {% trans "API" %}
  • {% trans "Available Methods" %}
  • {% endblock %} {% block navigation %}
    {% endblock %} {% block content %}

    Event notifications

    Event notifications are handled by the lava-publisher service on the master. You can subscribe to these events through lava-publisher service and receive events such as:

    To subscribe to these events, you can get the lava-publisher protocol and port via XML-RPC call from the server [ scheduler.get_publisher_event_socket ].

    For more information, visit lava-publisher docs.

    About XML-RPC API

    LAVA Server offers API services as an XML-RPC server. You can interact with it using any XML-RPC client. For example, in python you can do this:

    import xmlrpclib
    server = xmlrpclib.ServerProxy("{{ site_url }}{% url 'lava.api_handler' %}")
    print(server.system.listMethods())
    

    The following python code shows how to authenticate using an XML-RPC client, when a method requires authentication.

    WARNING: https:// scheme is recommended when using authentication.

      import xmlrpclib
      username = "USERNAME"
      token = "TOKEN_STRING"
      hostname = "HOSTNAME"  # {{ site_domain }}
      server = xmlrpclib.ServerProxy("{{ site_scheme }}://%s:%s@%s{% url 'lava.api_handler' %}" % (username, token, hostname))
      print(server.system.listMethods())
    

    NOTE: USERNAME is a valid username in the specified LAVA instance. TOKEN_STRING is a valid token associated with the above username in the same LAVA instance. HOSTNAME is the fully qualified domain name or IP address of the same LAVA instance.

    In the above code snippet the ServerProxy string is constructed from different components, with separators, which are clearly illustrated as follows:
    USERNAME:TOKEN_STRING@HOSTNAME/HANDLER

    Available functions

    Scheduler

    {% for method in methods.scheduler %} [ {{ method.name }} ] {% endfor %}

    Results

    {% for method in methods.results %} [ {{ method.name }} ] {% endfor %}

    System and Authentication

    {% for method in methods.system %} [ {{ method.name }} ] {% endfor %}
    {% for method in methods.scheduler %}

    {{ method.name }}

    {{ method.help }}
    Available functions
    {% endfor %} {% for method in methods.results %}

    {{ method.name }}

    {{ method.help }}
    Available functions
    {% endfor %} {% for method in methods.system %}

    {{ method.name }}

    {{ method.help }}
    Available functions
    {% endfor %} {% endblock %}