XML-RPC API Documentation

To use the XML-RPC interface, first make sure you have configured the interfacefactory properly by setting the default factory. See Configuring XML-RPC Interface Factories.

Then you can connect to supervisor’s HTTP portwith any XML-RPC client library and run commands against it.

An example of doing this using Python 2’s xmlrpclib client libraryis as follows.

  1. import xmlrpclib
  2. server = xmlrpclib.Server('http://localhost:9001/RPC2')

An example of doing this using Python 3’s xmlrpc.client libraryis as follows.

  1. from xmlrpc.client import ServerProxy
  2. server = ServerProxy('http://localhost:9001/RPC2')

You may call methods against supervisord and itssubprocesses by using the supervisor namespace. An example isprovided below.

  1. server.supervisor.getState()

You can get a list of methods supported by thesupervisord XML-RPC interface by using the XML-RPCsystem.listMethods API:

  1. server.system.listMethods()

You can see help on a method by using the system.methodHelp APIagainst the method:

  1. server.system.methodHelp('supervisor.shutdown')

The supervisord XML-RPC interface also supports theXML-RPC multicall API.

You can extend supervisord functionality with new XML-RPCAPI methods by adding new top-level RPC interfaces as necessary.See Configuring XML-RPC Interface Factories.

Note

Any XML-RPC method call may result in a fault response. This includes errors causedby the client such as bad arguments, and any errors that make supervisordunable to fulfill the request. Many XML-RPC client programs will raise an exceptionwhen a fault response is encountered.